A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ns3::TcpSocket Class Reference

(abstract) base class of all TcpSockets More...

#include <tcp-socket.h>

+ Inheritance diagram for ns3::TcpSocket:
+ Collaboration diagram for ns3::TcpSocket:

Public Member Functions

 TcpSocket (void)
virtual ~TcpSocket (void)
- Public Member Functions inherited from ns3::Socket
 Socket (void)
virtual ~Socket (void)
virtual int Bind (const Address &address)=0
 Allocate a local endpoint for this socket.
virtual int Bind ()=0
 Allocate a local IPv4 endpoint for this socket.
virtual int Bind6 ()=0
 Allocate a local IPv6 endpoint for this socket.
virtual void BindToNetDevice (Ptr< NetDevice > netdevice)
 Bind a socket to specific device.
virtual int Close (void)=0
 Close a socket.
virtual int Connect (const Address &address)=0
 Initiate a connection to a remote host.
virtual bool GetAllowBroadcast () const =0
 Query whether broadcast datagram transmissions are allowed.
Ptr< NetDeviceGetBoundNetDevice ()
 Returns socket's bound netdevice, if any.
virtual enum Socket::SocketErrno GetErrno (void) const =0
virtual Ptr< NodeGetNode (void) const =0
virtual uint32_t GetRxAvailable (void) const =0
virtual enum Socket::SocketType GetSocketType (void) const =0
virtual int GetSockName (Address &address) const =0
virtual uint32_t GetTxAvailable (void) const =0
 Returns the number of bytes which can be sent in a single call to Send.
bool IsRecvPktInfo () const
 Get status indicating whether enable/disable packet information to socket.
virtual int Listen (void)=0
 Listen for incoming connections.
virtual Ptr< PacketRecv (uint32_t maxSize, uint32_t flags)=0
 Read data from the socket.
Ptr< PacketRecv (void)
 Read a single packet from the socket.
int Recv (uint8_t *buf, uint32_t size, uint32_t flags)
 Recv data (or dummy data) from the remote host.
virtual Ptr< PacketRecvFrom (uint32_t maxSize, uint32_t flags, Address &fromAddress)=0
 Read a single packet from the socket and retrieve the sender address.
Ptr< PacketRecvFrom (Address &fromAddress)
 Read a single packet from the socket and retrieve the sender address.
int RecvFrom (uint8_t *buf, uint32_t size, uint32_t flags, Address &fromAddress)
 Read a single packet from the socket and retrieve the sender address.
virtual int Send (Ptr< Packet > p, uint32_t flags)=0
 Send data (or dummy data) to the remote host.
int Send (Ptr< Packet > p)
 Send data (or dummy data) to the remote host.
int Send (const uint8_t *buf, uint32_t size, uint32_t flags)
 Send data (or dummy data) to the remote host.
virtual int SendTo (Ptr< Packet > p, uint32_t flags, const Address &toAddress)=0
 Send data to a specified peer.
int SendTo (const uint8_t *buf, uint32_t size, uint32_t flags, const Address &address)
 Send data to a specified peer.
void SetAcceptCallback (Callback< bool, Ptr< Socket >, const Address & > connectionRequest, Callback< void, Ptr< Socket >, const Address & > newConnectionCreated)
 Accept connection requests from remote hosts.
virtual bool SetAllowBroadcast (bool allowBroadcast)=0
 Configure whether broadcast datagram transmissions are allowed.
void SetCloseCallbacks (Callback< void, Ptr< Socket > > normalClose, Callback< void, Ptr< Socket > > errorClose)
 Detect socket recv() events such as graceful shutdown or error.
void SetConnectCallback (Callback< void, Ptr< Socket > > connectionSucceeded, Callback< void, Ptr< Socket > > connectionFailed)
 Specify callbacks to allow the caller to determine if the connection succeeds of fails.
void SetDataSentCallback (Callback< void, Ptr< Socket >, uint32_t > dataSent)
 Notify application when a packet has been sent from transport protocol (non-standard socket call)
void SetRecvCallback (Callback< void, Ptr< Socket > >)
 Notify application when new data is available to be read.
void SetRecvPktInfo (bool flag)
 Enable/Disable receive packet information to socket.
void SetSendCallback (Callback< void, Ptr< Socket >, uint32_t > sendCb)
 Notify application when space in transmit buffer is added.
virtual int ShutdownRecv (void)=0
virtual int ShutdownSend (void)=0
- Public Member Functions inherited from ns3::Object
 Object ()
virtual ~Object ()
void AggregateObject (Ptr< Object > other)
void Dispose (void)
AggregateIterator GetAggregateIterator (void) const
virtual TypeId GetInstanceTypeId (void) const
template<typename T >
Ptr< T > GetObject (void) const
template<typename T >
Ptr< T > GetObject (TypeId tid) const
void Start (void)
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 SimpleRefCount (const SimpleRefCount &o)
uint32_t GetReferenceCount (void) const
SimpleRefCountoperator= (const SimpleRefCount &o)
void Ref (void) const
void Unref (void) const
- Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
void GetAttribute (std::string name, AttributeValue &value) const
bool GetAttributeFailSafe (std::string name, AttributeValue &attribute) const
void SetAttribute (std::string name, const AttributeValue &value)
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)

Static Public Member Functions

static TypeId GetTypeId (void)
 This method returns the TypeId associated to ns3::TcpSocket.
- Static Public Member Functions inherited from ns3::Socket
static Ptr< SocketCreateSocket (Ptr< Node > node, TypeId tid)

Static Public Attributes

static const char *const TcpStateName [LAST_STATE] = { "CLOSED", "LISTEN", "SYN_SENT", "SYN_RCVD", "ESTABLISHED", "CLOSE_WAIT", "LAST_ACK", "FIN_WAIT_1", "FIN_WAIT_2", "CLOSING", "TIME_WAIT" }

Private Member Functions

virtual uint32_t GetConnCount (void) const =0
virtual Time GetConnTimeout (void) const =0
virtual uint32_t GetDelAckMaxCount (void) const =0
virtual Time GetDelAckTimeout (void) const =0
virtual uint32_t GetInitialCwnd (void) const =0
virtual Time GetPersistTimeout (void) const =0
virtual uint32_t GetRcvBufSize (void) const =0
virtual uint32_t GetSegSize (void) const =0
virtual uint32_t GetSndBufSize (void) const =0
virtual uint32_t GetSSThresh (void) const =0
virtual bool GetTcpNoDelay (void) const =0
virtual void SetConnCount (uint32_t count)=0
virtual void SetConnTimeout (Time timeout)=0
virtual void SetDelAckMaxCount (uint32_t count)=0
virtual void SetDelAckTimeout (Time timeout)=0
virtual void SetInitialCwnd (uint32_t count)=0
virtual void SetPersistTimeout (Time timeout)=0
virtual void SetRcvBufSize (uint32_t size)=0
virtual void SetSegSize (uint32_t size)=0
virtual void SetSndBufSize (uint32_t size)=0
virtual void SetSSThresh (uint32_t threshold)=0
virtual void SetTcpNoDelay (bool noDelay)=0

Additional Inherited Members

- Public Types inherited from ns3::Socket
enum  SocketErrno {
  ERROR_NOTERROR, ERROR_ISCONN, ERROR_NOTCONN, ERROR_MSGSIZE,
  ERROR_AGAIN, ERROR_SHUTDOWN, ERROR_OPNOTSUPP, ERROR_AFNOSUPPORT,
  ERROR_INVAL, ERROR_BADF, ERROR_NOROUTETOHOST, ERROR_NODEV,
  ERROR_ADDRNOTAVAIL, ERROR_ADDRINUSE, SOCKET_ERRNO_LAST
}
enum  SocketType { NS3_SOCK_STREAM, NS3_SOCK_SEQPACKET, NS3_SOCK_DGRAM, NS3_SOCK_RAW }
- Protected Member Functions inherited from ns3::Socket
virtual void DoDispose (void)
void NotifyConnectionFailed (void)
bool NotifyConnectionRequest (const Address &from)
void NotifyConnectionSucceeded (void)
void NotifyDataRecv (void)
void NotifyDataSent (uint32_t size)
void NotifyErrorClose (void)
void NotifyNewConnectionCreated (Ptr< Socket > socket, const Address &from)
void NotifyNormalClose (void)
void NotifySend (uint32_t spaceAvailable)
- Protected Attributes inherited from ns3::Socket
Ptr< NetDevicem_boundnetdevice
bool m_recvPktInfo

Detailed Description

(abstract) base class of all TcpSockets

This class exists solely for hosting TcpSocket attributes that can be reused across different implementations.

Definition at line 62 of file tcp-socket.h.

Constructor & Destructor Documentation

ns3::TcpSocket::TcpSocket ( void  )

Definition at line 112 of file tcp-socket.cc.

References NS_LOG_FUNCTION_NOARGS.

ns3::TcpSocket::~TcpSocket ( void  )
virtual

Definition at line 117 of file tcp-socket.cc.

References NS_LOG_FUNCTION_NOARGS.

Member Function Documentation

virtual uint32_t ns3::TcpSocket::GetConnCount ( void  ) const
privatepure virtual

Implemented in ns3::TcpSocketBase.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

virtual Time ns3::TcpSocket::GetConnTimeout ( void  ) const
privatepure virtual

Implemented in ns3::TcpSocketBase.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

virtual uint32_t ns3::TcpSocket::GetDelAckMaxCount ( void  ) const
privatepure virtual

Implemented in ns3::TcpSocketBase.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

virtual Time ns3::TcpSocket::GetDelAckTimeout ( void  ) const
privatepure virtual

Implemented in ns3::TcpSocketBase.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

virtual uint32_t ns3::TcpSocket::GetInitialCwnd ( void  ) const
privatepure virtual

Implemented in ns3::TcpSocketBase, ns3::TcpTahoe, ns3::TcpReno, ns3::TcpNewReno, and ns3::TcpRfc793.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

virtual Time ns3::TcpSocket::GetPersistTimeout ( void  ) const
privatepure virtual

Implemented in ns3::TcpSocketBase.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

virtual uint32_t ns3::TcpSocket::GetRcvBufSize ( void  ) const
privatepure virtual

Implemented in ns3::TcpSocketBase.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

virtual uint32_t ns3::TcpSocket::GetSegSize ( void  ) const
privatepure virtual

Implemented in ns3::TcpSocketBase.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

virtual uint32_t ns3::TcpSocket::GetSndBufSize ( void  ) const
privatepure virtual

Implemented in ns3::TcpSocketBase.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

virtual uint32_t ns3::TcpSocket::GetSSThresh ( void  ) const
privatepure virtual

Implemented in ns3::TcpSocketBase, ns3::TcpTahoe, ns3::TcpReno, ns3::TcpNewReno, and ns3::TcpRfc793.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

virtual bool ns3::TcpSocket::GetTcpNoDelay ( void  ) const
privatepure virtual

Implemented in ns3::TcpSocketBase.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

TypeId ns3::TcpSocket::GetTypeId ( void  )
static

This method returns the TypeId associated to ns3::TcpSocket.

Attributes defined for this type:

  • SndBufSize: TcpSocket maximum transmit buffer size (bytes)
  • RcvBufSize: TcpSocket maximum receive buffer size (bytes)
  • SegmentSize: TCP maximum segment size in bytes (may be adjusted based on MTU discovery)
  • SlowStartThreshold: TCP slow start threshold (bytes)
  • InitialCwnd: TCP initial congestion window size (segments)
  • ConnTimeout: TCP retransmission timeout when opening connection (seconds)
    • Set with class: TimeValue
    • Underlying type: Time
    • Initial value: +3000000000.0ns
    • Flags: construct write read
  • ConnCount: Number of connection attempts (SYN retransmissions) before returning failure
  • DelAckTimeout: Timeout value for TCP delayed acks, in seconds
    • Set with class: TimeValue
    • Underlying type: Time
    • Initial value: +200000000.0ns
    • Flags: construct write read
  • DelAckCount: Number of packets to wait before sending a TCP ack
  • TcpNoDelay: Set to true to disable Nagle's algorithm
    • Set with class: BooleanValue
    • Underlying type: bool
    • Initial value: true
    • Flags: construct write read
  • PersistTimeout: Persist timeout to probe for rx window
    • Set with class: TimeValue
    • Underlying type: Time
    • Initial value: +6000000000.0ns
    • Flags: construct write read

No TraceSources defined for this type.

Reimplemented from ns3::Socket.

Reimplemented in ns3::TcpSocketBase, ns3::NscTcpSocketImpl, ns3::TcpTahoe, ns3::TcpRfc793, ns3::TcpReno, and ns3::TcpNewReno.

Definition at line 39 of file tcp-socket.cc.

References GetConnCount(), GetConnTimeout(), GetDelAckMaxCount(), GetDelAckTimeout(), GetInitialCwnd(), GetPersistTimeout(), GetRcvBufSize(), GetSegSize(), GetSndBufSize(), GetSSThresh(), GetTcpNoDelay(), ns3::Seconds(), SetConnCount(), SetConnTimeout(), SetDelAckMaxCount(), SetDelAckTimeout(), SetInitialCwnd(), ns3::TypeId::SetParent(), SetPersistTimeout(), SetRcvBufSize(), SetSegSize(), SetSndBufSize(), SetSSThresh(), and SetTcpNoDelay().

+ Here is the call graph for this function:

virtual void ns3::TcpSocket::SetConnCount ( uint32_t  count)
privatepure virtual

Implemented in ns3::TcpSocketBase.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

virtual void ns3::TcpSocket::SetConnTimeout ( Time  timeout)
privatepure virtual

Implemented in ns3::TcpSocketBase.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

virtual void ns3::TcpSocket::SetDelAckMaxCount ( uint32_t  count)
privatepure virtual

Implemented in ns3::TcpSocketBase.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

virtual void ns3::TcpSocket::SetDelAckTimeout ( Time  timeout)
privatepure virtual

Implemented in ns3::TcpSocketBase.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

virtual void ns3::TcpSocket::SetInitialCwnd ( uint32_t  count)
privatepure virtual

Implemented in ns3::TcpSocketBase, ns3::TcpTahoe, ns3::TcpReno, ns3::TcpNewReno, and ns3::TcpRfc793.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

virtual void ns3::TcpSocket::SetPersistTimeout ( Time  timeout)
privatepure virtual

Implemented in ns3::TcpSocketBase.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

virtual void ns3::TcpSocket::SetRcvBufSize ( uint32_t  size)
privatepure virtual

Implemented in ns3::TcpSocketBase.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

virtual void ns3::TcpSocket::SetSegSize ( uint32_t  size)
privatepure virtual

Implemented in ns3::TcpSocketBase, ns3::TcpTahoe, ns3::TcpReno, and ns3::TcpNewReno.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

virtual void ns3::TcpSocket::SetSndBufSize ( uint32_t  size)
privatepure virtual

Implemented in ns3::TcpSocketBase.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

virtual void ns3::TcpSocket::SetSSThresh ( uint32_t  threshold)
privatepure virtual

Implemented in ns3::TcpSocketBase, ns3::TcpTahoe, ns3::TcpReno, ns3::TcpNewReno, and ns3::TcpRfc793.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

virtual void ns3::TcpSocket::SetTcpNoDelay ( bool  noDelay)
privatepure virtual

Implemented in ns3::TcpSocketBase.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

Member Data Documentation


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