ns-3
|
A base class for implementation of a stream socket using TCP. More...
#include <tcp-socket-base.h>
Public Member Functions | |
TcpSocketBase (void) | |
TcpSocketBase (const TcpSocketBase &sock) | |
virtual void | SetNode (Ptr< Node > node) |
virtual void | SetTcp (Ptr< TcpL4Protocol > tcp) |
virtual void | SetRtt (Ptr< RttEstimator > rtt) |
virtual enum SocketErrno | GetErrno (void) const |
virtual enum SocketType | GetSocketType (void) const |
virtual Ptr< Node > | GetNode (void) const |
virtual int | Bind (void) |
virtual int | Bind (const Address &address) |
virtual int | Connect (const Address &address) |
virtual int | Listen (void) |
virtual int | Close (void) |
virtual int | ShutdownSend (void) |
virtual int | ShutdownRecv (void) |
virtual int | Send (Ptr< Packet > p, uint32_t flags) |
virtual int | SendTo (Ptr< Packet > p, uint32_t flags, const Address &toAddress) |
virtual Ptr< Packet > | Recv (uint32_t maxSize, uint32_t flags) |
virtual Ptr< Packet > | RecvFrom (uint32_t maxSize, uint32_t flags, Address &fromAddress) |
virtual uint32_t | GetTxAvailable (void) const |
virtual uint32_t | GetRxAvailable (void) const |
virtual int | GetSockName (Address &address) const |
virtual void | BindToNetDevice (Ptr< NetDevice > netdevice) |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
This method returns the TypeId associated to ns3::TcpSocketBase. | |
Protected Member Functions | |
virtual void | SetSndBufSize (uint32_t size) |
virtual uint32_t | GetSndBufSize (void) const |
virtual void | SetRcvBufSize (uint32_t size) |
virtual uint32_t | GetRcvBufSize (void) const |
virtual void | SetSegSize (uint32_t size) |
virtual uint32_t | GetSegSize (void) const |
virtual void | SetSSThresh (uint32_t threshold)=0 |
virtual uint32_t | GetSSThresh (void) const =0 |
virtual void | SetInitialCwnd (uint32_t cwnd)=0 |
virtual uint32_t | GetInitialCwnd (void) const =0 |
virtual void | SetConnTimeout (Time timeout) |
virtual Time | GetConnTimeout (void) const |
virtual void | SetConnCount (uint32_t count) |
virtual uint32_t | GetConnCount (void) const |
virtual void | SetDelAckTimeout (Time timeout) |
virtual Time | GetDelAckTimeout (void) const |
virtual void | SetDelAckMaxCount (uint32_t count) |
virtual uint32_t | GetDelAckMaxCount (void) const |
virtual void | SetTcpNoDelay (bool noDelay) |
virtual bool | GetTcpNoDelay (void) const |
virtual void | SetPersistTimeout (Time timeout) |
virtual Time | GetPersistTimeout (void) const |
virtual bool | SetAllowBroadcast (bool allowBroadcast) |
Configure whether broadcast datagram transmissions are allowed. | |
virtual bool | GetAllowBroadcast (void) const |
Query whether broadcast datagram transmissions are allowed. | |
int | SetupCallback (void) |
int | DoConnect (void) |
void | ConnectionSucceeded (void) |
int | SetupEndpoint (void) |
void | CompleteFork (Ptr< Packet >, const TcpHeader &, const Address &fromAddress, const Address &toAdress) |
void | ForwardUp (Ptr< Packet > packet, Ipv4Header header, uint16_t port, Ptr< Ipv4Interface > incomingInterface) |
virtual void | DoForwardUp (Ptr< Packet > packet, Ipv4Header header, uint16_t port, Ptr< Ipv4Interface > incomingInterface) |
bool | SendPendingData (bool withAck=false) |
uint32_t | SendDataPacket (SequenceNumber32 seq, uint32_t maxSize, bool withAck) |
void | SendEmptyPacket (uint8_t flags) |
void | SendRST (void) |
bool | OutOfRange (SequenceNumber32 head, SequenceNumber32 tail) const |
int | DoClose (void) |
void | CloseAndNotify (void) |
void | Destroy (void) |
void | DeallocateEndPoint (void) |
void | PeerClose (Ptr< Packet >, const TcpHeader &) |
void | DoPeerClose (void) |
void | CancelAllTimers (void) |
void | TimeWait (void) |
void | ProcessEstablished (Ptr< Packet >, const TcpHeader &) |
void | ProcessListen (Ptr< Packet >, const TcpHeader &, const Address &, const Address &) |
void | ProcessSynSent (Ptr< Packet >, const TcpHeader &) |
void | ProcessSynRcvd (Ptr< Packet >, const TcpHeader &, const Address &, const Address &) |
void | ProcessWait (Ptr< Packet >, const TcpHeader &) |
void | ProcessClosing (Ptr< Packet >, const TcpHeader &) |
void | ProcessLastAck (Ptr< Packet >, const TcpHeader &) |
virtual uint32_t | UnAckDataCount (void) |
virtual uint32_t | BytesInFlight (void) |
virtual uint32_t | Window (void) |
virtual uint32_t | AvailableWindow (void) |
virtual uint16_t | AdvertisedWindowSize (void) |
virtual Ptr< TcpSocketBase > | Fork (void)=0 |
virtual void | ReceivedAck (Ptr< Packet >, const TcpHeader &) |
virtual void | ReceivedData (Ptr< Packet >, const TcpHeader &) |
virtual void | EstimateRtt (const TcpHeader &) |
virtual void | NewAck (SequenceNumber32 const &seq) |
virtual void | DupAck (const TcpHeader &t, uint32_t count)=0 |
virtual void | ReTxTimeout (void) |
virtual void | Retransmit (void) |
virtual void | DelAckTimeout (void) |
virtual void | LastAckTimeout (void) |
virtual void | PersistTimeout (void) |
virtual void | DoRetransmit (void) |
virtual void | ReadOptions (const TcpHeader &) |
virtual void | AddOptions (TcpHeader &) |
Protected Attributes | |
EventId | m_retxEvent |
EventId | m_lastAckEvent |
EventId | m_delAckEvent |
EventId | m_persistEvent |
EventId | m_timewaitEvent |
uint32_t | m_dupAckCount |
uint32_t | m_delAckCount |
uint32_t | m_delAckMaxCount |
bool | m_noDelay |
uint32_t | m_cnCount |
uint32_t | m_cnRetries |
TracedValue< Time > | m_rto |
TracedValue< Time > | m_lastRtt |
Time | m_delAckTimeout |
Time | m_persistTimeout |
Time | m_cnTimeout |
Ipv4EndPoint * | m_endPoint |
Ptr< Node > | m_node |
Ptr< TcpL4Protocol > | m_tcp |
Ptr< RttEstimator > | m_rtt |
TracedValue< SequenceNumber32 > | m_nextTxSequence |
TracedValue< SequenceNumber32 > | m_highTxMark |
TcpRxBuffer | m_rxBuffer |
TcpTxBuffer | m_txBuffer |
TracedValue< TcpStates_t > | m_state |
enum SocketErrno | m_errno |
bool | m_closeNotified |
bool | m_closeOnEmpty |
bool | m_shutdownSend |
bool | m_shutdownRecv |
bool | m_connected |
double | m_msl |
uint32_t | m_segmentSize |
uint16_t | m_maxWinSize |
TracedValue< uint32_t > | m_rWnd |
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@gatech.edu> of Georgia Tech.
ns3::TcpSocketBase::TcpSocketBase | ( | void | ) |
Create an unbound TCP socket
References NS_LOG_FUNCTION.
ns3::TcpSocketBase::TcpSocketBase | ( | const TcpSocketBase & | sock | ) |
Clone a TCP socket, for use upon receiving a connection request in LISTEN state
References NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::Socket::SetConnectCallback(), ns3::Socket::SetDataSentCallback(), ns3::Socket::SetRecvCallback(), and ns3::Socket::SetSendCallback().
void ns3::TcpSocketBase::AddOptions | ( | TcpHeader & | ) | [protected, virtual] |
Placeholder function for future extension that changes the TCP header
Referenced by DoForwardUp(), SendDataPacket(), and SendEmptyPacket().
int ns3::TcpSocketBase::Bind | ( | void | ) | [virtual] |
Inherit from Socket class: Bind socket to an end-point in TcpL4Protocol
Implements ns3::Socket.
References NS_LOG_FUNCTION_NOARGS, and SetupCallback().
Referenced by BindToNetDevice(), and Connect().
int ns3::TcpSocketBase::Bind | ( | const Address & | address | ) | [virtual] |
Inherit from Socket class: Bind socket (with specific address) to an end-point in TcpL4Protocol
Implements ns3::Socket.
References ns3::InetSocketAddress::ConvertFrom(), ns3::Ipv4Address::GetAny(), ns3::InetSocketAddress::GetIpv4(), ns3::InetSocketAddress::GetPort(), ns3::InetSocketAddress::IsMatchingType(), NS_LOG_FUNCTION, NS_LOG_LOGIC, and SetupCallback().
void ns3::TcpSocketBase::BindToNetDevice | ( | Ptr< NetDevice > | netdevice | ) | [virtual] |
Inherit from Socket class: Bind this socket to the specified NetDevice
Reimplemented from ns3::Socket.
References Bind(), NS_ASSERT, and NS_LOG_FUNCTION.
int ns3::TcpSocketBase::Close | ( | void | ) | [virtual] |
Inherit from Socket class: Kill this socket and signal the peer (if any)
Implements ns3::Socket.
References DoClose(), NS_LOG_FUNCTION, NS_LOG_INFO, SendRST(), and ns3::TcpTxBuffer::SizeFromSequence().
Referenced by DoPeerClose().
void ns3::TcpSocketBase::CloseAndNotify | ( | void | ) | [protected] |
Peacefully close the socket by notifying the upper layer and deallocate end point
References DeallocateEndPoint(), NS_LOG_FUNCTION, and NS_LOG_INFO.
Referenced by DoClose(), DoConnect(), ProcessClosing(), ProcessEstablished(), ProcessLastAck(), ProcessSynRcvd(), ProcessSynSent(), ProcessWait(), SendEmptyPacket(), and TimeWait().
void ns3::TcpSocketBase::CompleteFork | ( | Ptr< Packet > | p, |
const TcpHeader & | h, | ||
const Address & | fromAddress, | ||
const Address & | toAddress | ||
) | [protected] |
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.
References ns3::InetSocketAddress::ConvertFrom(), ns3::TcpHeader::GetSequenceNumber(), NS_LOG_INFO, SendEmptyPacket(), and SetupCallback().
Referenced by ProcessListen().
int ns3::TcpSocketBase::Connect | ( | const Address & | address | ) | [virtual] |
Inherit from Socket class: Initiate connection to a remote address:port
Implements ns3::Socket.
Reimplemented in ns3::TcpTahoe, ns3::TcpReno, and ns3::TcpNewReno.
References Bind(), ns3::InetSocketAddress::ConvertFrom(), DoConnect(), ns3::InetSocketAddress::GetIpv4(), ns3::InetSocketAddress::GetPort(), NS_ASSERT, NS_LOG_FUNCTION, and SetupEndpoint().
void ns3::TcpSocketBase::DeallocateEndPoint | ( | void | ) | [protected] |
Deallocate the end point and cancel all the timers
Referenced by CloseAndNotify(), and SendRST().
void ns3::TcpSocketBase::Destroy | ( | void | ) | [protected] |
Kill this socket. This is a callback function configured to m_endpoint in SetupCallback(), invoked when the endpoint is destroyed.
References ns3::Simulator::GetDelayLeft(), ns3::Simulator::Now(), NS_LOG_FUNCTION, and NS_LOG_LOGIC.
Referenced by SetupCallback().
int ns3::TcpSocketBase::DoClose | ( | void | ) | [protected] |
Do the action to close the socket. Usually send a packet with appropriate flags depended on the current m_state.
References CloseAndNotify(), NS_LOG_FUNCTION, NS_LOG_INFO, SendEmptyPacket(), and SendRST().
Referenced by Close().
int ns3::TcpSocketBase::DoConnect | ( | void | ) | [protected] |
Perform the real connection tasks: Send SYN if allowed, RST if invalid
References CloseAndNotify(), NS_LOG_FUNCTION, NS_LOG_INFO, SendEmptyPacket(), and SendRST().
Referenced by Connect().
void ns3::TcpSocketBase::DoForwardUp | ( | Ptr< Packet > | packet, |
Ipv4Header | header, | ||
uint16_t | port, | ||
Ptr< Ipv4Interface > | incomingInterface | ||
) | [protected, virtual] |
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.
References AddOptions(), ns3::EventId::Cancel(), EstimateRtt(), ns3::Ipv4Header::GetDestination(), ns3::Packet::GetSize(), ns3::Ipv4Header::GetSource(), NS_LOG_LOGIC, OutOfRange(), ProcessClosing(), ProcessEstablished(), ProcessLastAck(), ProcessListen(), ProcessSynRcvd(), ProcessSynSent(), ProcessWait(), ReadOptions(), ns3::Packet::RemoveHeader(), SendEmptyPacket(), ns3::TcpHeader::SetAckNumber(), ns3::TcpHeader::SetDestinationPort(), ns3::TcpHeader::SetFlags(), ns3::TcpHeader::SetSequenceNumber(), ns3::TcpHeader::SetSourcePort(), and ns3::TcpHeader::SetWindowSize().
Referenced by ForwardUp().
void ns3::TcpSocketBase::DoPeerClose | ( | void | ) | [protected] |
Received a in-sequence FIN. Close down this socket.
References Close(), NS_ASSERT, NS_LOG_INFO, NS_LOG_LOGIC, ns3::Simulator::Schedule(), and SendEmptyPacket().
Referenced by PeerClose().
void ns3::TcpSocketBase::EstimateRtt | ( | const TcpHeader & | tcpHeader | ) | [protected, virtual] |
Called by ForwardUp() to estimate RTT
References ns3::TcpHeader::GetAckNumber().
Referenced by DoForwardUp().
void ns3::TcpSocketBase::ForwardUp | ( | Ptr< Packet > | packet, |
Ipv4Header | header, | ||
uint16_t | port, | ||
Ptr< Ipv4Interface > | incomingInterface | ||
) | [protected] |
Function called by the L3 protocol when it received a packet to pass on to the TCP. This function is registered as the "RxCallback" function in SetupCallback(), which invoked by Bind(), and CompleteFork()
References DoForwardUp().
Referenced by SetupCallback().
bool ns3::TcpSocketBase::GetAllowBroadcast | ( | void | ) | const [protected, virtual] |
Query whether broadcast datagram transmissions are allowed.
This method corresponds to using getsockopt() SO_BROADCAST of real network or BSD sockets.
Implements ns3::Socket.
enum Socket::SocketErrno ns3::TcpSocketBase::GetErrno | ( | void | ) | const [virtual] |
Inherit from Socket class: Returns error code
Implements ns3::Socket.
Ptr< Node > ns3::TcpSocketBase::GetNode | ( | void | ) | const [virtual] |
Inherit from Socket class: Returns associated node
Implements ns3::Socket.
References NS_LOG_FUNCTION_NOARGS.
uint32_t ns3::TcpSocketBase::GetRxAvailable | ( | void | ) | const [virtual] |
Inherit from Socket class: Get the max number of bytes an app can read
Implements ns3::Socket.
References NS_LOG_FUNCTION.
enum Socket::SocketType ns3::TcpSocketBase::GetSocketType | ( | void | ) | const [virtual] |
Inherit from Socket class: Returns socket type, NS3_SOCK_STREAM
Implements ns3::Socket.
int ns3::TcpSocketBase::GetSockName | ( | Address & | address | ) | const [virtual] |
Inherit from Socket class: Return local address:port
Implements ns3::Socket.
References ns3::Ipv4Address::GetZero(), and NS_LOG_FUNCTION.
uint32_t ns3::TcpSocketBase::GetTxAvailable | ( | void | ) | const [virtual] |
Inherit from Socket class: Get the max number of bytes an app can send
Implements ns3::Socket.
References ns3::TcpTxBuffer::Available(), and NS_LOG_FUNCTION.
Referenced by ProcessSynRcvd().
TypeId ns3::TcpSocketBase::GetTypeId | ( | void | ) | [static] |
This method returns the TypeId associated to ns3::TcpSocketBase.
This object is accessible through the following paths with Config::Set and Config::Connect:
Attributes defined for this type:
Attributes defined in parent class ns3::TcpSocket:
TraceSources defined for this type:
Reimplemented from ns3::TcpSocket.
Reimplemented in ns3::TcpTahoe, ns3::TcpRfc793, ns3::TcpReno, and ns3::TcpNewReno.
References ns3::MakeTraceSourceAccessor(), and ns3::TypeId::SetParent().
int ns3::TcpSocketBase::Listen | ( | void | ) | [virtual] |
Inherit from Socket class: Listen on the endpoint for an incoming connection
Implements ns3::Socket.
Reimplemented in ns3::TcpTahoe, ns3::TcpReno, and ns3::TcpNewReno.
References NS_LOG_FUNCTION, and NS_LOG_INFO.
bool ns3::TcpSocketBase::OutOfRange | ( | SequenceNumber32 | head, |
SequenceNumber32 | tail | ||
) | const [protected] |
Tell if a sequence number range is out side the range that my rx buffer can accpet
Referenced by DoForwardUp().
void ns3::TcpSocketBase::PeerClose | ( | Ptr< Packet > | p, |
const TcpHeader & | tcpHeader | ||
) | [protected] |
Peer sent me a FIN. Remember its sequence in rx buffer.
References DoPeerClose(), ns3::TcpHeader::GetSequenceNumber(), ns3::Packet::GetSize(), NS_LOG_FUNCTION, NS_LOG_INFO, and NS_LOG_LOGIC.
Referenced by ProcessEstablished(), and ProcessSynRcvd().
void ns3::TcpSocketBase::ProcessClosing | ( | Ptr< Packet > | packet, |
const TcpHeader & | tcpHeader | ||
) | [protected] |
Received a packet upon CLOSING
References CloseAndNotify(), ns3::TcpHeader::GetFlags(), ns3::TcpHeader::GetSequenceNumber(), NS_LOG_FUNCTION, NS_LOG_LOGIC, SendEmptyPacket(), SendRST(), and TimeWait().
Referenced by DoForwardUp().
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.
References CloseAndNotify(), ns3::TcpHeader::GetFlags(), NS_LOG_FUNCTION, NS_LOG_LOGIC, PeerClose(), ReceivedAck(), and SendRST().
Referenced by DoForwardUp().
void ns3::TcpSocketBase::ProcessLastAck | ( | Ptr< Packet > | packet, |
const TcpHeader & | tcpHeader | ||
) | [protected] |
Received a packet upon LAST_ACK
References CloseAndNotify(), ns3::TcpHeader::GetFlags(), ns3::TcpHeader::GetSequenceNumber(), NS_LOG_FUNCTION, NS_LOG_LOGIC, SendEmptyPacket(), and SendRST().
Referenced by DoForwardUp().
void ns3::TcpSocketBase::ProcessListen | ( | Ptr< Packet > | packet, |
const TcpHeader & | tcpHeader, | ||
const Address & | fromAddress, | ||
const Address & | toAddress | ||
) | [protected] |
Received a packet upon LISTEN state.
References CompleteFork(), ns3::TcpHeader::GetFlags(), NS_LOG_FUNCTION, NS_LOG_LOGIC, and ns3::Simulator::ScheduleNow().
Referenced by DoForwardUp().
void ns3::TcpSocketBase::ProcessSynRcvd | ( | Ptr< Packet > | packet, |
const TcpHeader & | tcpHeader, | ||
const Address & | fromAddress, | ||
const Address & | toAddress | ||
) | [protected] |
Received a packet upon SYN_RCVD
References ns3::EventId::Cancel(), CloseAndNotify(), ns3::InetSocketAddress::ConvertFrom(), ns3::TcpHeader::GetAckNumber(), ns3::TcpHeader::GetFlags(), ns3::TcpHeader::GetSequenceNumber(), GetTxAvailable(), NS_LOG_FUNCTION, NS_LOG_INFO, NS_LOG_LOGIC, PeerClose(), ReceivedAck(), SendEmptyPacket(), SendRST(), and ns3::TcpTxBuffer::SetHeadSequence().
Referenced by DoForwardUp().
void ns3::TcpSocketBase::ProcessSynSent | ( | Ptr< Packet > | packet, |
const TcpHeader & | tcpHeader | ||
) | [protected] |
Received a packet upon SYN_SENT
References ns3::EventId::Cancel(), CloseAndNotify(), ns3::TcpHeader::GetAckNumber(), ns3::TcpHeader::GetFlags(), ns3::TcpHeader::GetSequenceNumber(), NS_LOG_FUNCTION, NS_LOG_INFO, NS_LOG_LOGIC, ns3::Simulator::ScheduleNow(), SendEmptyPacket(), SendPendingData(), SendRST(), and ns3::TcpTxBuffer::SetHeadSequence().
Referenced by DoForwardUp().
void ns3::TcpSocketBase::ProcessWait | ( | Ptr< Packet > | packet, |
const TcpHeader & | tcpHeader | ||
) | [protected] |
Received a packet upon CLOSE_WAIT, FIN_WAIT_1, or FIN_WAIT_2 states
References CloseAndNotify(), ns3::TcpHeader::GetAckNumber(), ns3::TcpHeader::GetFlags(), ns3::TcpHeader::GetSequenceNumber(), ns3::Packet::GetSize(), NS_LOG_FUNCTION, NS_LOG_INFO, NS_LOG_LOGIC, ReceivedAck(), SendEmptyPacket(), SendRST(), ns3::TcpTxBuffer::Size(), and TimeWait().
Referenced by DoForwardUp().
void ns3::TcpSocketBase::ReadOptions | ( | const TcpHeader & | ) | [protected, virtual] |
Placeholder function for future extension that reads more from the TCP header
Referenced by DoForwardUp().
void ns3::TcpSocketBase::ReceivedAck | ( | Ptr< Packet > | packet, |
const TcpHeader & | tcpHeader | ||
) | [protected, virtual] |
Process the newly received ACK
References ns3::TcpHeader::GetAckNumber(), ns3::TcpHeader::GetFlags(), ns3::Packet::GetSize(), ns3::TcpTxBuffer::HeadSequence(), NS_ASSERT, NS_LOG_FUNCTION, and NS_LOG_LOGIC.
Referenced by ProcessEstablished(), ProcessSynRcvd(), and ProcessWait().
Ptr< Packet > ns3::TcpSocketBase::Recv | ( | uint32_t | maxSize, |
uint32_t | flags | ||
) | [virtual] |
Inherit from Socket class: Return data to upper-layer application. Parameter flags is not used. Data is returned as a packet of size no larger than maxSize
Implements ns3::Socket.
References ns3::Packet::AddPacketTag(), ns3::TcpRxBuffer::Extract(), ns3::Packet::GetSize(), NS_ABORT_MSG_IF, and NS_LOG_FUNCTION.
Ptr< Packet > ns3::TcpSocketBase::RecvFrom | ( | uint32_t | maxSize, |
uint32_t | flags, | ||
Address & | fromAddress | ||
) | [virtual] |
Inherit from Socket class: Recv and return the remote's address
Implements ns3::Socket.
References ns3::Packet::GetSize(), ns3::Ipv4Address::GetZero(), NS_LOG_FUNCTION, and ns3::Socket::Recv().
int ns3::TcpSocketBase::Send | ( | Ptr< Packet > | p, |
uint32_t | flags | ||
) | [virtual] |
Inherit from Socket class: Send a packet. Parameter flags is not used. Packet has no TCP header. Invoked by upper-layer application
Implements ns3::Socket.
References ns3::TcpTxBuffer::Add(), ns3::Packet::GetSize(), NS_ABORT_MSG_IF, NS_LOG_FUNCTION, NS_LOG_LOGIC, SendPendingData(), and ns3::TcpTxBuffer::Size().
Referenced by SendTo().
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
References AddOptions(), ns3::TcpTxBuffer::CopyFromSequence(), ns3::Packet::GetSize(), ns3::EventId::IsExpired(), ns3::Simulator::Now(), NS_LOG_FUNCTION, NS_LOG_INFO, NS_LOG_LOGIC, ns3::Simulator::Schedule(), ns3::Simulator::ScheduleNow(), ns3::TcpHeader::SetAckNumber(), ns3::TcpHeader::SetDestinationPort(), ns3::TcpHeader::SetFlags(), ns3::TcpHeader::SetSequenceNumber(), ns3::TcpHeader::SetSourcePort(), ns3::TcpHeader::SetWindowSize(), and ns3::TcpTxBuffer::SizeFromSequence().
Referenced by ns3::TcpNewReno::DupAck(), and SendPendingData().
void ns3::TcpSocketBase::SendEmptyPacket | ( | uint8_t | flags | ) | [protected] |
Send an empty packet with specified TCP flags
References AddOptions(), ns3::EventId::Cancel(), CloseAndNotify(), ns3::EventId::IsExpired(), ns3::Simulator::Now(), NS_LOG_FUNCTION, NS_LOG_LOGIC, NS_LOG_WARN, and ns3::Simulator::Schedule().
Referenced by CompleteFork(), DoClose(), DoConnect(), DoForwardUp(), DoPeerClose(), ProcessClosing(), ProcessLastAck(), ProcessSynRcvd(), ProcessSynSent(), ProcessWait(), and SendRST().
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
References ns3::TcpTxBuffer::HeadSequence(), NS_LOG_FUNCTION, NS_LOG_INFO, NS_LOG_LOGIC, SendDataPacket(), ns3::TcpTxBuffer::Size(), and ns3::TcpTxBuffer::SizeFromSequence().
Referenced by ns3::TcpNewReno::DupAck(), ProcessSynSent(), and Send().
void ns3::TcpSocketBase::SendRST | ( | void | ) | [protected] |
This function closes the endpoint completely. Called upon RST_TX action.
References DeallocateEndPoint(), NS_LOG_FUNCTION, and SendEmptyPacket().
Referenced by Close(), DoClose(), DoConnect(), ProcessClosing(), ProcessEstablished(), ProcessLastAck(), ProcessSynRcvd(), ProcessSynSent(), and ProcessWait().
int ns3::TcpSocketBase::SendTo | ( | Ptr< Packet > | p, |
uint32_t | flags, | ||
const Address & | address | ||
) | [virtual] |
Inherit from Socket class: In TcpSocketBase, it is same as Send() call
Implements ns3::Socket.
References Send().
bool ns3::TcpSocketBase::SetAllowBroadcast | ( | bool | allowBroadcast | ) | [protected, virtual] |
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.
allowBroadcast | Whether broadcast is allowed |
Implements ns3::Socket.
void ns3::TcpSocketBase::SetNode | ( | Ptr< Node > | node | ) | [virtual] |
Associate a node with this TCP socket
void ns3::TcpSocketBase::SetRtt | ( | Ptr< RttEstimator > | rtt | ) | [virtual] |
Set an RTT estimator with this socket
void ns3::TcpSocketBase::SetSndBufSize | ( | uint32_t | size | ) | [protected, virtual] |
Below are the attribute get/set functions
Implements ns3::TcpSocket.
References ns3::TcpTxBuffer::SetMaxBufferSize().
void ns3::TcpSocketBase::SetTcp | ( | Ptr< TcpL4Protocol > | tcp | ) | [virtual] |
Associate the L4 protocol (e.g. mux/demux) with this socket
int ns3::TcpSocketBase::SetupCallback | ( | void | ) | [protected] |
Clean up after Bind. Set up callback functions in the end-point.
References Destroy(), ForwardUp(), ns3::MakeCallback(), and NS_LOG_FUNCTION.
Referenced by Bind(), and CompleteFork().
int ns3::TcpSocketBase::SetupEndpoint | ( | void | ) | [protected] |
Configure the endpoint to a local address. Called by Connect() if Bind() didn't specify one.
References ns3::Object::GetObject(), ns3::Ipv4::GetRoutingProtocol(), ns3::Ipv4Route::GetSource(), NS_ASSERT, NS_FATAL_ERROR, NS_LOG_ERROR, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::Ipv4RoutingProtocol::RouteOutput(), and ns3::Ipv4Header::SetDestination().
Referenced by Connect().
int ns3::TcpSocketBase::ShutdownRecv | ( | void | ) | [virtual] |
Inherit from Socket class: Signal a termination of receive
Implements ns3::Socket.
References NS_LOG_FUNCTION.
int ns3::TcpSocketBase::ShutdownSend | ( | void | ) | [virtual] |
Inherit from Socket class: Signal a termination of send
Implements ns3::Socket.
References NS_LOG_FUNCTION.
void ns3::TcpSocketBase::TimeWait | ( | void | ) | [protected] |
Move TCP to Time_Wait state and schedule a transition to Closed state
References CloseAndNotify(), NS_LOG_INFO, ns3::Simulator::Schedule(), and ns3::Seconds().
Referenced by ProcessClosing(), and ProcessWait().