22 #define NS_LOG_APPEND_CONTEXT \ 
   23   if (m_node) { std::clog << Simulator::Now ().GetSeconds () << " [node " << m_node->GetId () << "] "; } 
   25 #include "ns3/abort.h" 
   27 #include "ns3/inet-socket-address.h" 
   28 #include "ns3/inet6-socket-address.h" 
   32 #include "ns3/ipv4-interface-address.h" 
   33 #include "ns3/ipv4-route.h" 
   34 #include "ns3/ipv6-route.h" 
   35 #include "ns3/ipv4-routing-protocol.h" 
   36 #include "ns3/ipv6-routing-protocol.h" 
   37 #include "ns3/simulation-singleton.h" 
   38 #include "ns3/simulator.h" 
   39 #include "ns3/packet.h" 
   40 #include "ns3/uinteger.h" 
   41 #include "ns3/double.h" 
   42 #include "ns3/trace-source-accessor.h" 
   70     .AddAttribute (
"MaxSegLifetime",
 
   71                    "Maximum segment lifetime in seconds, use for TIME_WAIT state transition to CLOSED state",
 
   74                    MakeDoubleChecker<double> (0))
 
   75     .AddAttribute (
"MaxWindowSize", 
"Max size of advertised window",
 
   78                    MakeUintegerChecker<uint16_t> ())
 
   79     .AddAttribute (
"IcmpCallback", 
"Callback invoked whenever an icmp error is received on this socket.",
 
   82                    MakeCallbackChecker ())
 
   83     .AddAttribute (
"IcmpCallback6", 
"Callback invoked whenever an icmpv6 error is received on this socket.",
 
   86                    MakeCallbackChecker ())                   
 
   87     .AddTraceSource (
"RTO",
 
   88                      "Retransmission timeout",
 
   90     .AddTraceSource (
"RTT",
 
   93     .AddTraceSource (
"NextTxSequence",
 
   94                      "Next sequence number to send (SND.NXT)",
 
   96     .AddTraceSource (
"HighestSequence",
 
   97                      "Highest sequence number ever sent in socket's life time",
 
   99     .AddTraceSource (
"State",
 
  102     .AddTraceSource (
"RWND",
 
  103                      "Remote side's flow control window",
 
  117     m_nextTxSequence (0),
 
  123     m_errno (ERROR_NOTERROR),
 
  124     m_closeNotified (false),
 
  125     m_closeOnEmpty (false),
 
  126     m_shutdownSend (false),
 
  127     m_shutdownRecv (false),
 
  139     m_dupAckCount (sock.m_dupAckCount),
 
  141     m_delAckMaxCount (sock.m_delAckMaxCount),
 
  142     m_noDelay (sock.m_noDelay),
 
  143     m_cnRetries (sock.m_cnRetries),
 
  144     m_delAckTimeout (sock.m_delAckTimeout),
 
  145     m_persistTimeout (sock.m_persistTimeout),
 
  146     m_cnTimeout (sock.m_cnTimeout),
 
  149     m_node (sock.m_node),
 
  152     m_nextTxSequence (sock.m_nextTxSequence),
 
  153     m_highTxMark (sock.m_highTxMark),
 
  154     m_rxBuffer (sock.m_rxBuffer),
 
  155     m_txBuffer (sock.m_txBuffer),
 
  156     m_state (sock.m_state),
 
  157     m_errno (sock.m_errno),
 
  158     m_closeNotified (sock.m_closeNotified),
 
  159     m_closeOnEmpty (sock.m_closeOnEmpty),
 
  160     m_shutdownSend (sock.m_shutdownSend),
 
  161     m_shutdownRecv (sock.m_shutdownRecv),
 
  162     m_connected (sock.m_connected),
 
  164     m_segmentSize (sock.m_segmentSize),
 
  165     m_maxWinSize (sock.m_maxWinSize),
 
  178   Callback<void, Ptr<Socket>, uint32_t> vPSUI = MakeNullCallback<void, Ptr<Socket>, uint32_t> ();
 
  268   m_tcp->m_sockets.push_back (
this);
 
  282   m_tcp->m_sockets.push_back (
this);
 
  350   m_tcp->m_sockets.push_back (
this);
 
  455       NS_LOG_INFO (
"Socket " << 
this << 
" << unread rx data during close.  Sending reset");
 
  521   NS_ABORT_MSG_IF (flags, 
"use of flags is not supported in TcpSocketBase::Send()");
 
  554   return Send (p, flags); 
 
  563   NS_ABORT_MSG_IF (flags, 
"use of flags is not supported in TcpSocketBase::Recv()");
 
  566       return Create<Packet> (); 
 
  569   if (outPacket != 0 && outPacket->
GetSize () != 0)
 
  592   if (packet != 0 && packet->
GetSize () != 0)
 
  810   DoForwardUp (packet, header, port, incomingInterface);
 
  821                             uint8_t icmpType, uint8_t icmpCode,
 
  824   NS_LOG_FUNCTION (
this << icmpSource << (uint32_t)icmpTtl << (uint32_t)icmpType <<
 
  825                    (uint32_t)icmpCode << icmpInfo);
 
  828       m_icmpCallback (icmpSource, icmpTtl, icmpType, icmpCode, icmpInfo);
 
  834                             uint8_t icmpType, uint8_t icmpCode,
 
  837   NS_LOG_FUNCTION (
this << icmpSource << (uint32_t)icmpTtl << (uint32_t)icmpType <<
 
  838                    (uint32_t)icmpCode << icmpInfo);
 
  870   if (
m_rWnd.
Get () == 0 && tcpHeader.GetWindowSize () != 0)
 
  872       NS_LOG_LOGIC (
this << 
" Leaving zerowindow persist state");
 
  875   m_rWnd = tcpHeader.GetWindowSize ();
 
  879       && 
OutOfRange (tcpHeader.GetSequenceNumber (), tcpHeader.GetSequenceNumber () + packet->
GetSize ()))
 
  882                     " received packet of seq [" << tcpHeader.GetSequenceNumber () <<
 
  883                     ":" << tcpHeader.GetSequenceNumber () + packet->
GetSize () <<
 
  965   if (
m_rWnd.
Get () == 0 && tcpHeader.GetWindowSize () != 0)
 
  967       NS_LOG_LOGIC (
this << 
" Leaving zerowindow persist state");
 
  970   m_rWnd = tcpHeader.GetWindowSize ();
 
  974       && 
OutOfRange (tcpHeader.GetSequenceNumber (), tcpHeader.GetSequenceNumber () + packet->
GetSize ()))
 
  977                     " received packet of seq [" << tcpHeader.GetSequenceNumber () <<
 
  978                     ":" << tcpHeader.GetSequenceNumber () + packet->
GetSize () <<
 
 1066   else if (tcpflags == 0)
 
 1078           NS_LOG_LOGIC (
"Illegal flag " << tcpflags << 
" received. Reset packet is sent.");
 
 1149                           packet, tcpHeader, fromAddress, toAddress);
 
 1203           NS_LOG_LOGIC (
"Illegal flag " << std::hex << static_cast<uint32_t> (tcpflags) << std::dec << 
" received. Reset packet is sent.");
 
 1283           NS_LOG_LOGIC (
"Illegal flag " << tcpflags << 
" received. Reset packet is sent.");
 
 1339           NS_LOG_LOGIC (
"Illegal flag " << tcpflags << 
" received. Reset packet is sent.");
 
 1396           NS_LOG_LOGIC (
"Illegal flag " << tcpflags << 
" received. Reset packet is sent.");
 
 1433       NS_LOG_LOGIC (
"Illegal flag " << tcpflags << 
" received. Reset packet is sent.");
 
 1494       NS_LOG_LOGIC (
"TCP " << 
this << 
" calling NotifyNormalClose");
 
 1508       NS_LOG_LOGIC (
"TcpSocketBase " << 
this << 
" scheduling LATO1");
 
 1523       std::vector<Ptr<TcpSocketBase> >::iterator it
 
 1524         = std::find (
m_tcp->m_sockets.begin (), 
m_tcp->m_sockets.end (), 
this);
 
 1525       if (it != 
m_tcp->m_sockets.end ())
 
 1527           m_tcp->m_sockets.erase (it);
 
 1530   NS_LOG_LOGIC (
this << 
" Cancelled ReTxTimeout event which was set to expire at " <<
 
 1544       std::vector<Ptr<TcpSocketBase> >::iterator it
 
 1545         = std::find (
m_tcp->m_sockets.begin (), 
m_tcp->m_sockets.end (), 
this);
 
 1546       if (it != 
m_tcp->m_sockets.end ())
 
 1548           m_tcp->m_sockets.erase (it);
 
 1551   NS_LOG_LOGIC (
this << 
" Cancelled ReTxTimeout event which was set to expire at " <<
 
 1601       NS_LOG_WARN (
"Failed to send empty packet due to null endpoint");
 
 1613   header.SetFlags (flags);
 
 1614   header.SetSequenceNumber (s);
 
 1664       NS_LOG_LOGIC (
"Schedule retransmission timeout at time " 
 1690       std::vector<Ptr<TcpSocketBase> >::iterator it
 
 1691         = std::find (
m_tcp->m_sockets.begin (), 
m_tcp->m_sockets.end (), 
this);
 
 1692       if (it != 
m_tcp->m_sockets.end ())
 
 1694           m_tcp->m_sockets.erase (it);
 
 1703       std::vector<Ptr<TcpSocketBase> >::iterator it
 
 1704         = std::find (
m_tcp->m_sockets.begin (), 
m_tcp->m_sockets.end (), 
this);
 
 1705       if (it != 
m_tcp->m_sockets.end ())
 
 1707           m_tcp->m_sockets.erase (it);
 
 1720   if (ipv4->GetRoutingProtocol () == 0)
 
 1731   route = ipv4->GetRoutingProtocol ()->RouteOutput (
Ptr<Packet> (), header, oif, errno_);
 
 1750   if (ipv6->GetRoutingProtocol () == 0)
 
 1761   route = ipv6->GetRoutingProtocol ()->RouteOutput (
Ptr<Packet> (), header, oif, errno_);
 
 1798   m_tcp->m_sockets.push_back (
this);
 
 1903       NS_LOG_LOGIC (
this << 
" SendDataPacket Schedule ReTxTimeout at time " <<
 
 1908   NS_LOG_LOGIC (
"Send packet via TcpL4Protocol with flags 0x" << std::hex << static_cast<uint32_t> (flags) << std::dec);
 
 1919   m_rtt->SentSeq (seq, sz);       
 
 1947   uint32_t nPacketsSent = 0;
 
 1951       NS_LOG_LOGIC (
"TcpSocketBase " << 
this << 
" SendPendingData" <<
 
 1969           NS_LOG_LOGIC (
"Invoking Nagle's algorithm. Wait to send.");
 
 1977   NS_LOG_LOGIC (
"SendPendingData sent " << nPacketsSent << 
" packets");
 
 1978   return (nPacketsSent > 0);
 
 2007   uint32_t win = 
Window (); 
 
 2008   NS_LOG_LOGIC (
"UnAckCount=" << unack << 
", Win=" << win);
 
 2009   return (win < unack) ? 0 : (win - unack);
 
 2025                 " pkt size " << p->
GetSize () );
 
 2064           NS_LOG_WARN (
"Why TCP " << 
this << 
" got data after close notification?");
 
 2104       NS_LOG_LOGIC (
this << 
" Cancelled ReTxTimeout event which was set to expire at " <<
 
 2109       NS_LOG_LOGIC (
this << 
" Schedule ReTxTimeout at time " <<
 
 2116       NS_LOG_LOGIC (
this << 
"Enter zerowindow persist state");
 
 2117       NS_LOG_LOGIC (
this << 
"Cancelled ReTxTimeout event which was set to expire at " <<
 
 2140       NS_LOG_LOGIC (
this << 
" Cancelled ReTxTimeout event which was set to expire at " <<
 
 2236   m_rtt->IncreaseMultiplier (); 
 
 2413   return (!allowBroadcast);
 
static Time GetDelayLeft(const EventId &id)
Ipv6Address GetLocalAddress()
Get the local address. 
void PeerClose(Ptr< Packet > p, const TcpHeader &tcpHeader)
Received a FIN from peer, notify rx buffer. 
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer. 
void SetTclass(uint8_t tclass)
Set the tag's Tclass. 
void ProcessListen(Ptr< Packet > packet, const TcpHeader &tcpHeader, const Address &fromAddress, const Address &toAddress)
Received a packet upon LISTEN state. 
Ipv6Address GetIpv6(void) const 
Get the IPv6 address. 
virtual int Listen(void)
Listen for incoming connections. 
keep track of time values and allow control of global simulation resolution 
bool IsManualIpTtl(void) const 
Checks if the socket has a specific IPv4 TTL set. 
virtual int GetSockName(Address &address) const 
Get socket address. 
Ipv4Address GetIpv4(void) const 
static Ipv4Address GetAny(void)
uint32_t Size(void) const 
Returns total number of bytes in this Tx buffer. 
#define NS_LOG_FUNCTION(parameters)
void ProcessWait(Ptr< Packet > packet, const TcpHeader &tcpHeader)
Received a packet upon CLOSE_WAIT, FIN_WAIT_1, FIN_WAIT_2. 
virtual uint8_t GetIpTtl(void) const 
Query the value of IP Time to Live field of this socket. 
virtual uint16_t AdvertisedWindowSize(void)
The amount of Rx window announced to the peer. 
bool Add(Ptr< Packet > p, TcpHeader const &tcph)
Insert a packet into the buffer and update the availBytes counter to reflect the number of bytes read...
NS_LOG_COMPONENT_DEFINE("TcpSocketBase")
bool m_noDelay
Set to true to disable Nagle's algorithm. 
virtual uint32_t GetSegSize(void) const 
Get the segment size. 
uint8_t GetIpTos(void) const 
Query the value of IP Type of Service of this socket. 
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. 
This class implements a tag that carries the socket-specific HOPLIMIT of a packet to the IPv6 layer...
void DiscardUpTo(const SequenceNumber32 &seq)
Discard data up to but not including this sequence number. 
(abstract) base class of all TcpSockets 
Ipv4EndPoint * m_endPoint
the IPv4 endpoint 
virtual ~TcpSocketBase(void)
TracedValue< Time > m_lastRtt
Last RTT sample collected. 
void NotifyDataRecv(void)
Notify through the callback (if set) that some data have been received. 
virtual int ShutdownRecv(void)
uint32_t SizeFromSequence(const SequenceNumber32 &seq) const 
Returns the number of bytes from the buffer in the range [seq, tailSequence) 
void SetRxCallback(Callback< void, Ptr< Packet >, Ipv4Header, uint16_t, Ptr< Ipv4Interface > > callback)
Set the reception callback. 
TcpSocketBase(void)
Create an unbound TCP socket. 
EventId m_retxEvent
Retransmission event. 
SequenceNumber32 HeadSequence(void) const 
Returns the first byte's sequence number. 
Ptr< Packet > Recv(void)
Read a single packet from the socket. 
IPv6 layer implementation. 
void SetDestroyCallback(Callback< void > callback)
Set the default destroy callback. 
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. 
void AddPacketTag(const Tag &tag) const 
Add a packet tag. 
void SetAddress(Address addr)
Set the tag's address. 
virtual void SetPersistTimeout(Time timeout)
Set the timout for persistent connection. 
virtual int Send(Ptr< Packet > p, uint32_t flags)
Send data (or dummy data) to the remote host. 
virtual bool GetAllowBroadcast(void) const 
Query whether broadcast datagram transmissions are allowed. 
EventId m_timewaitEvent
TIME_WAIT expiration event: Move this socket to CLOSED state. 
void NotifyConnectionFailed(void)
Notify through the callback (if set) that the connection has not been established due to an error...
static TypeId GetTypeId(void)
Get the type ID. 
uint32_t Available() const 
Get the actual number of bytes available to be read. 
#define NS_ASSERT(condition)
void SendRST(void)
Send reset and tear down this socket. 
uint32_t MaxBufferSize(void) const 
Returns the Tx window size. 
static Ipv6Address GetAny()
Get the "any" (::) Ipv6Address. 
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
uint16_t m_maxWinSize
Maximum window size to advertise. 
uint32_t GetSize(void) const 
bool IsManualIpTos(void) const 
Checks if the socket has a specific IPv4 ToS set. 
Callback< void, Ipv4Address, uint8_t, uint8_t, uint8_t, uint32_t > m_icmpCallback
ICMP callback. 
void CancelAllTimers(void)
Cancel all timer when endpoint is deleted. 
void BindToNetDevice(Ptr< NetDevice > netdevice)
Bind a socket to specific device. 
virtual uint8_t GetIpv6HopLimit(void) const 
Query the value of IP Hop Limit field of this socket. 
Time m_cnTimeout
Timeout for connection retry. 
uint32_t m_segmentSize
Segment size. 
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function. 
EventId m_lastAckEvent
Last ACK timeout event. 
void ConnectionSucceeded(void)
Schedule-friendly wrapper for Socket::NotifyConnectionSucceeded() 
void SetFinSequence(const SequenceNumber32 &s)
Set the FIN Sequence number (i.e., the one closing the connection) 
void SetTos(uint8_t tos)
Set the tag's TOS. 
TracedValue< SequenceNumber32 > m_nextTxSequence
Next seqnum to be sent (SND.NXT), ReTx pushes it back. 
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
Schedule an event to expire at the relative time "time" is reached. 
virtual void ReceivedAck(Ptr< Packet > packet, const TcpHeader &tcpHeader)
Received an ACK packet. 
uint32_t m_cnCount
Count of remaining connection retries. 
This class implements a tag that carries the socket-specific TTL of a packet to the IP layer...
virtual Time GetPersistTimeout(void) const 
Get the timout for persistent connection. 
SocketErrno
Enumeration of the possible errors returned by a socket. 
void DoPeerClose(void)
FIN is in sequence, notify app and respond with a FIN. 
bool NotifyConnectionRequest(const Address &from)
Notify through the callback (if set) that an incoming connection is being requested by a remote host...
SequenceNumber32 NextRxSequence(void) const 
Get Next Rx Sequence number. 
virtual void PersistTimeout(void)
Send 1 byte probe to get an updated window size. 
TracedValue< TcpStates_t > m_state
TCP state. 
uint32_t m_delAckMaxCount
Number of packet to fire an ACK before delay timeout. 
#define NS_ABORT_MSG_UNLESS(cond, msg)
Abnormal program termination if cond is false. 
#define NS_FATAL_ERROR(msg)
fatal error handling 
a polymophic address class 
void SetDestroyCallback(Callback< void > callback)
Set the default destroy callback. 
uint16_t GetPeerPort()
Get the peer port. 
AttributeValue form of a Callback. 
uint32_t m_cnRetries
Number of connection retries before giving up. 
virtual uint32_t GetRcvBufSize(void) const 
Get the receive buffer size. 
uint32_t m_delAckCount
Delayed ACK counter. 
virtual bool GetTcpNoDelay(void) const 
Check if Nagle's algorithm is enabled or not. 
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. 
virtual int Bind(void)
Allocate a local IPv4 endpoint for this socket. 
SequenceNumber< uint32_t, int32_t > SequenceNumber32
SequenceNumber32 MaxRxSequence(void) const 
Get the lowest sequence number that this TcpRxBuffer cannot accept. 
TcpTxBuffer m_txBuffer
Tx buffer. 
virtual void Retransmit(void)
Halving cwnd and call DoRetransmit() 
void SetLocalAddress(Ipv6Address addr)
Set the local address. 
virtual void ReadOptions(const TcpHeader &tcpHeader)
Read option from incoming packets. 
virtual int SendTo(Ptr< Packet > p, uint32_t flags, const Address &toAddress)
Send data to a specified peer. 
virtual void EstimateRtt(const TcpHeader &tcpHeader)
Take into account the packet for RTT estimation. 
virtual uint32_t UnAckDataCount(void)
Return count of number of unacked bytes. 
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. 
static const char *const TcpStateName[LAST_STATE]
Literal names of TCP states for use in log messages. 
void SetTtl(uint8_t ttl)
Set the tag's TTL. 
virtual uint32_t GetSndBufSize(void) const 
Get the send buffer size. 
virtual enum SocketType GetSocketType(void) const 
uint16_t GetLocalPort()
Get the local port. 
Hold an unsigned integer type. 
Ipv6EndPoint * m_endPoint6
the IPv6 endpoint 
virtual void BindToNetDevice(Ptr< NetDevice > netdevice)
Bind a socket to specific device. 
bool OutOfRange(SequenceNumber32 head, SequenceNumber32 tail) const 
Check if a sequence number range is within the rx window. 
virtual bool SetAllowBroadcast(bool allowBroadcast)
Configure whether broadcast datagram transmissions are allowed. 
Ipv4Address GetLocalAddress(void)
Get the local address. 
virtual void SetTcpNoDelay(bool noDelay)
Enable/Disable Nagle's algorithm. 
This class implements a tag that carries an address of a packet across the socket interface...
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
bool IsManualIpv6Tclass(void) const 
Checks if the socket has a specific IPv6 Tclass set. 
void NotifyDataSent(uint32_t size)
Notify through the callback (if set) that some data have been sent. 
virtual uint32_t GetConnCount(void) const 
Get the number of connection retries before giving up. 
void SetRecvCallback(Callback< void, Ptr< Socket > >)
Notify application when new data is available to be read. 
enum SocketErrno m_errno
Socket error code. 
Ipv4Address GetSource(void) const 
void SetNextRxSequence(const SequenceNumber32 &s)
Set the Next Sequence number. 
A base class for implementation of a stream socket using TCP. 
Ptr< RttEstimator > m_rtt
Round trip time estimator. 
bool m_closeNotified
Told app to close socket. 
void ProcessSynSent(Ptr< Packet > packet, const TcpHeader &tcpHeader)
Received a packet upon SYN_SENT. 
int SetupCallback(void)
Common part of the two Bind(), i.e. 
#define NS_LOG_LOGIC(msg)
virtual void SetTcp(Ptr< TcpL4Protocol > tcp)
Set the associated TCP L4 protocol. 
Ptr< TcpL4Protocol > m_tcp
the associated TCP L4 protocol 
void SetHopLimit(uint8_t hopLimit)
Set the tag's Hop Limit. 
void SetMaxBufferSize(uint32_t n)
Set the Tx window size. 
void ProcessSynRcvd(Ptr< Packet > packet, const TcpHeader &tcpHeader, const Address &fromAddress, const Address &toAddress)
Received a packet upon SYN_RCVD. 
virtual int ShutdownSend(void)
void NotifyConnectionSucceeded(void)
Notify through the callback (if set) that the connection has been established. 
uint32_t Available(void) const 
Returns the available capacity in this Tx window. 
Access to the Ipv4 forwarding table, interfaces, and configuration. 
void SetMaxBufferSize(uint32_t s)
Set the Maximum buffer size. 
bool IsManualIpv6HopLimit(void) const 
Checks if the socket has a specific IPv6 Hop Limit set. 
virtual void SetDelAckMaxCount(uint32_t count)
Set the number of packet to fire an ACK before delay timeout. 
void NotifyNormalClose(void)
Notify through the callback (if set) that the connection has been closed. 
int DoConnect(void)
Perform the real connection tasks: Send SYN if allowed, RST if invalid. 
void CompleteFork(Ptr< Packet > p, const TcpHeader &tcpHeader, const Address &fromAddress, const Address &toAddress)
Complete a connection by forking the socket. 
virtual void AddOptions(TcpHeader &tcpHeader)
Add option to outgoing packets. 
Ptr< Packet > Extract(uint32_t maxSize)
Extract data from the head of the buffer as indicated by nextRxSeq. 
uint32_t m_dupAckCount
Dupack counter. 
static InetSocketAddress ConvertFrom(const Address &address)
Ptr< Node > m_node
the associated node 
void NotifyNewConnectionCreated(Ptr< Socket > socket, const Address &from)
Notify through the callback (if set) that a new connection has been created. 
void TimeWait(void)
Move from CLOSING or FIN_WAIT_2 to TIME_WAIT state. 
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
virtual void SetNode(Ptr< Node > node)
Set the associated node. 
void SetIcmpCallback(Callback< void, Ipv6Address, uint8_t, uint8_t, uint8_t, uint32_t > callback)
Set the ICMP callback. 
virtual uint32_t BytesInFlight(void)
Return total bytes in flight. 
indicates whether the socket has IPV6_TCLASS set. 
uint8_t GetIpv6Tclass(void) const 
Query the value of IPv6 Traffic Class field of this socket. 
void Destroy(void)
Kill this socket by zeroing its attributes (IPv4) 
bool Add(Ptr< Packet > p)
Append a data packet to the end of the buffer. 
virtual int Connect(const Address &address)
Initiate a connection to a remote host. 
static EventId ScheduleNow(MEM mem_ptr, OBJ obj)
Schedule an event to expire Now. 
virtual int Close(void)
Close a socket. 
static Ipv4Address GetZero(void)
void SetPeer(Ipv4Address address, uint16_t port)
Set the peer informations (address and port). 
static Time Now(void)
Return the "current simulation time". 
virtual uint32_t AvailableWindow(void)
Return unfilled portion of window. 
void SetSendCallback(Callback< void, Ptr< Socket >, uint32_t > sendCb)
Notify application when space in transmit buffer is added. 
virtual Ptr< TcpSocketBase > Fork(void)=0
Call CopyObject<> to clone me. 
virtual void DupAck(const TcpHeader &tcpHeader, uint32_t count)=0
Received dupack (duplicate ACK) 
virtual void SetRtt(Ptr< RttEstimator > rtt)
Set the associated RTT estimator. 
double m_msl
Max segment lifetime. 
virtual void ReTxTimeout(void)
Call Retransmit() upon RTO event. 
TracedValue< SequenceNumber32 > m_highTxMark
Highest seqno ever sent, regardless of ReTx. 
virtual void BindToNetDevice(Ptr< NetDevice > netdevice)
Bind a socket to specific device. 
void SendEmptyPacket(uint8_t flags)
Send a empty packet that carries a flag, e.g. 
Time m_delAckTimeout
Time to delay an ACK. 
void SetDataSentCallback(Callback< void, Ptr< Socket >, uint32_t > dataSent)
Notify application when a packet has been sent from transport protocol (non-standard socket call) ...
virtual Ptr< Packet > RecvFrom(uint32_t maxSize, uint32_t flags, Address &fromAddress)
Read a single packet from the socket and retrieve the sender address. 
void SetLocalAddress(Ipv4Address address)
Set the local address. 
virtual void SetSndBufSize(uint32_t size)
Set the send buffer size. 
virtual void SetDelAckTimeout(Time timeout)
Set the time to delay an ACK. 
virtual void NewAck(SequenceNumber32 const &seq)
Update buffers w.r.t. 
void DeallocateEndPoint(void)
Deallocate m_endPoint. 
TcpRxBuffer m_rxBuffer
Rx buffer (reordering buffer) 
Describes an IPv6 address. 
uint32_t MaxBufferSize(void) const 
Get the Maximum buffer size. 
Ipv4 addresses are stored in host order in this class. 
void ProcessEstablished(Ptr< Packet > packet, const TcpHeader &tcpHeader)
Received a packet upon ESTABLISHED state. 
Ptr< NetDevice > m_boundnetdevice
the device this socket is bound to (might be null). 
bool m_connected
Connection established. 
TracedValue< Time > m_rto
Retransmit timeout. 
uint16_t GetLocalPort(void)
Get the local port. 
Ipv6Address GetPeerAddress()
Get the peer address. 
int DoClose(void)
Close a socket by sending RST, FIN, or FIN+ACK, depend on the current state. 
virtual void SetConnCount(uint32_t count)
Set the number of connection retries before giving up. 
static Inet6SocketAddress ConvertFrom(const Address &addr)
Convert the address to a InetSocketAddress. 
Ipv4Address GetPeerAddress(void)
Get the peer address. 
void SetRxCallback(Callback< void, Ptr< Packet >, Ipv6Header, uint16_t, Ptr< Ipv6Interface > > callback)
Set the reception callback. 
static bool IsMatchingType(const Address &addr)
If the address match. 
uint16_t GetPeerPort(void)
Get the peer port. 
uint16_t GetPort(void) const 
Get the port. 
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::cancel method. 
virtual uint32_t Window(void)
Return the max possible number of unacked bytes. 
virtual enum SocketErrno GetErrno(void) const 
Get last error number. 
void ProcessLastAck(Ptr< Packet > packet, const TcpHeader &tcpHeader)
Received a packet upon LAST_ACK. 
Ipv4Address GetIpv4MappedAddress() const 
Return the Ipv4 address. 
virtual void SetSegSize(uint32_t size)
Set the segment size. 
void ProcessClosing(Ptr< Packet > packet, const TcpHeader &tcpHeader)
Received a packet upon CLOSING. 
#define NS_LOG_ERROR(msg)
uint16_t GetPort(void) const 
virtual void ReceivedData(Ptr< Packet > packet, const TcpHeader &tcpHeader)
Recv of a data, put into buffer, call L7 to get it if necessary. 
void SetConnectCallback(Callback< void, Ptr< Socket > > connectionSucceeded, Callback< void, Ptr< Socket > > connectionFailed)
Specify callbacks to allow the caller to determine if the connection succeeds of fails. 
void CloseAndNotify(void)
Peacefully close the socket by notifying the upper layer and deallocate end point. 
Callback< void, Ipv6Address, uint8_t, uint8_t, uint8_t, uint32_t > m_icmpCallback6
ICMPv6 callback. 
virtual Ptr< Node > GetNode(void) const 
Return the node this socket is associated with. 
virtual void SetRcvBufSize(uint32_t size)
Set the receive buffer size. 
bool m_shutdownRecv
Receive no longer allowed. 
virtual Time GetDelAckTimeout(void) const 
Get the time to delay an ACK. 
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if cond is true. 
virtual void DelAckTimeout(void)
Action upon delay ACK timeout, i.e. 
virtual void LastAckTimeout(void)
Timeout at LAST_ACK, close the connection. 
uint32_t Size(void) const 
Get the actual buffer occupancy. 
Hold a floating point type. 
virtual void DoForwardUp(Ptr< Packet > packet, Ipv4Header header, uint16_t port, Ptr< Ipv4Interface > incomingInterface)
Called by TcpSocketBase::ForwardUp(). 
virtual int Bind6(void)
Allocate a local IPv6 endpoint for this socket. 
indicates whether the socket has IP_TOS set. 
bool IsExpired(void) const 
This method is syntactic sugar for the ns3::Simulator::isExpired method. 
Ptr< T > GetObject(void) const 
void SetIcmpCallback(Callback< void, Ipv4Address, uint8_t, uint8_t, uint8_t, uint32_t > callback)
Set the ICMP callback. 
SocketType
Enumeration of the possible socket types. 
bool IsIpv4MappedAddress() const 
If the address is an IPv4-mapped address. 
EventId m_delAckEvent
Delayed ACK timeout event. 
a unique identifier for an interface. 
bool m_shutdownSend
Send no longer allowed. 
int SetupEndpoint6(void)
Configure the endpoint v6 to a local address. 
void NotifySend(uint32_t spaceAvailable)
Notify through the callback (if set) that some data have been sent. 
TypeId SetParent(TypeId tid)
bool SendPendingData(bool withAck=false)
Send as much pending data as possible according to the Tx window. 
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. 
TracedValue< uint32_t > m_rWnd
Flow control window at remote side. 
static bool IsMatchingType(const Address &address)
void NotifyErrorClose(void)
Notify through the callback (if set) that the connection has been closed due to an error...
virtual void DoRetransmit(void)
Retransmit the oldest packet. 
bool m_closeOnEmpty
Close socket upon tx buffer emptied. 
virtual uint32_t GetDelAckMaxCount(void) const 
Get the number of packet to fire an ACK before delay timeout. 
virtual void SetConnTimeout(Time timeout)
Set the connection timeout. 
EventId m_persistEvent
Persist event: Send 1 byte to probe for a non-zero Rx window. 
void SetPeer(Ipv6Address addr, uint16_t port)
Set the peer informations (address and port). 
int SetupEndpoint(void)
Configure the endpoint to a local address. 
virtual Time GetConnTimeout(void) const 
Get the connection timeout. 
bool Finished(void)
Check if the buffer did receive all the data (and the connection is closed) 
void Destroy6(void)
Kill this socket by zeroing its attributes (IPv6) 
void SetHeadSequence(const SequenceNumber32 &seq)
Set the m_firstByteSeq to seq. 
Time m_persistTimeout
Time between sending 1-byte probes. 
virtual uint32_t GetTxAvailable(void) const 
Returns the number of bytes which can be sent in a single call to Send. 
virtual uint32_t GetRxAvailable(void) const 
Return number of bytes which can be returned from one or multiple calls to Recv. 
Ptr< Packet > CopyFromSequence(uint32_t numBytes, const SequenceNumber32 &seq)
Copy data of size numBytes into a packet, data from the range [seq, seq+numBytes) ...