|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
16 #ifndef NSC_TCP_SOCKET_IMPL_H
17 #define NSC_TCP_SOCKET_IMPL_H
23 #include "ns3/callback.h"
24 #include "ns3/traced-value.h"
25 #include "ns3/tcp-socket.h"
27 #include "ns3/ipv4-address.h"
28 #include "ns3/inet-socket-address.h"
29 #include "ns3/event-id.h"
31 #include "ns3/sequence-number.h"
40 class NscTcpL4Protocol;
90 virtual int Bind (
void);
91 virtual int Bind6 (
void);
93 virtual int Close (
void);
bool m_closeOnEmpty
true if socket will close when buffer is empty
a unique identifier for an interface.
virtual Ptr< Packet > RecvFrom(uint32_t maxSize, uint32_t flags, Address &fromAddress)
Read a single packet from the socket and retrieve the sender address.
uint32_t m_initialCWnd
Initial cWnd value.
SocketErrno
Enumeration of the possible errors returned by a socket.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
virtual uint32_t GetAdvWin(void) const
Get the Advertised Window size.
virtual int Close(void)
Close a socket.
uint32_t m_rxAvailable
receive buffer available size
Ptr< Packet > Recv(void)
Read a single packet from the socket.
uint32_t m_rcvBufSize
maximum receive socket buffer size
virtual uint32_t GetInitialSSThresh(void) const
Get the initial Slow Start Threshold.
Ipv4Address m_localAddress
local address
bool m_connected
Connection established.
uint32_t m_sndBufSize
buffer limit for the outgoing queue
Time m_lastMeasuredRtt
Last measured RTT.
virtual int Bind6(void)
Allocate a local IPv6 endpoint for this socket.
virtual ~NscTcpSocketImpl()
Ipv4 addresses are stored in host order in this class.
virtual void BindToNetDevice(Ptr< NetDevice > netdevice)
Bind a socket to specific device.
uint32_t m_txBufferSize
transmission buffer size
virtual Time GetConnTimeout(void) const
Get the connection timeout.
Time m_persistTimeout
Time between sending 1-byte probes.
TracedValue< uint32_t > m_cWnd
Congestion window.
static TypeId GetTypeId(void)
Get the type ID.
virtual int GetPeerName(Address &address) const
Get the peer address of a connected socket.
virtual void SetSndBufSize(uint32_t size)
Set the send buffer size.
uint32_t m_dataRetries
Count of remaining data retransmission attempts.
virtual enum SocketType GetSocketType(void) const
virtual void SetSynRetries(uint32_t count)
Set the number of connection retries before giving up.
void ForwardUp(Ptr< Packet > p, Ipv4Header header, uint16_t port, Ptr< Ipv4Interface > incomingInterface)
Called by the L3 protocol when it received a packet to pass on to TCP.
virtual void SetInitialSSThresh(uint32_t threshold)
Set the initial Slow Start Threshold.
virtual void SetSegSize(uint32_t size)
Set the segment size.
virtual int GetSockName(Address &address) const
Get socket address.
bool ReadPendingData(void)
Read all the pending data.
virtual uint32_t GetInitialCwnd(void) const
Get the initial Congestion Window.
Time m_delAckTimeout
Time to delay an ACK.
bool m_noDelay
Disable ACk delay.
Ipv4Address m_remoteAddress
peer IP address
virtual int ShutdownRecv(void)
uint32_t m_initialSsThresh
Initial Slow Start Threshold.
a polymophic address class
virtual void SetRcvBufSize(uint32_t size)
Set the receive buffer size.
NscTcpSocketImpl()
Create an unbound tcp socket.
INetStreamSocket * m_nscTcpSocket
the real NSC TCP socket
virtual bool GetTcpNoDelay(void) const
Check if Nagle's algorithm is enabled or not.
virtual void SetTcpNoDelay(bool noDelay)
Enable/Disable Nagle's algorithm.
(abstract) base class of all TcpSockets
TracedValue< uint32_t > m_ssThresh
Slow Start Threshold.
virtual void SetDelAckMaxCount(uint32_t count)
Set the number of packet to fire an ACK before delay timeout.
virtual void SetAdvWin(uint32_t window)
Set the Advertised Window size.
std::queue< Ptr< Packet > > m_txBuffer
transmission buffer
SocketType
Enumeration of the possible socket types.
uint32_t m_delAckMaxCount
Number of packet to fire an ACK before delay timeout.
enum SocketErrno m_errno
last error number
virtual uint32_t GetTxAvailable(void) const
Returns the number of bytes which can be sent in a single call to Send.
TracedValue< TcpStates_t > m_state
state information
Simulation virtual time values and global simulation resolution.
Socket logic for the NSC TCP sockets.
virtual int SendTo(Ptr< Packet > p, uint32_t flags, const Address &toAddress)
Send data to a specified peer.
virtual uint32_t GetRcvBufSize(void) const
Get the receive buffer size.
virtual int Bind(void)
Allocate a local IPv4 endpoint for this socket.
virtual void SetDelAckTimeout(Time timeout)
Set the time to delay an ACK.
Ptr< NscTcpSocketImpl > Copy()
Copy self.
virtual Time GetDelAckTimeout(void) const
Get the time to delay an ACK.
virtual uint32_t GetSegSize(void) const
Get the segment size.
uint16_t m_remotePort
peer port
virtual enum SocketErrno GetErrno(void) const
Get last error number.
Ptr< NscTcpL4Protocol > m_tcp
the associated TCP L4 protocol
enum Socket::SocketErrno GetNativeNs3Errno(int err) const
Translate between a NSC error and a ns-3 error code.
uint16_t m_localPort
local port
void CompleteFork(void)
Complete the Fork operations (after a connection has been accepted)
bool m_shutdownRecv
Receive no longer allowed.
virtual int Connect(const Address &address)
Initiate a connection to a remote host.
Struct interface to NSC Stream (i.e., TCP) Sockets.
bool SendPendingData(void)
Send all the pending data.
Ipv4EndPoint * m_endPoint
the IPv4 endpoint
virtual int Listen(void)
Listen for incoming connections.
virtual Time GetPersistTimeout(void) const
Get the timeout for persistent connection.
void ConnectionSucceeded()
Called when a connection is in Established state.
bool m_shutdownSend
Send no longer allowed.
virtual bool SetAllowBroadcast(bool allowBroadcast)
Configure whether broadcast datagram transmissions are allowed.
virtual uint32_t GetSndBufSize(void) const
Get the send buffer size.
void NSCWakeup(void)
Called by NscTcpSocketImpl::ForwardUp()
Ptr< Node > m_node
the associated node
virtual int Send(Ptr< Packet > p, uint32_t flags)
Send data (or dummy data) to the remote host.
uint32_t m_advertisedWindowSize
Window to advertise.
virtual uint32_t GetSynRetries(void) const
Get the number of connection retries before giving up.
virtual void SetInitialCwnd(uint32_t cwnd)
Set the initial Congestion Window.
virtual uint32_t GetRxAvailable(void) const
Return number of bytes which can be returned from one or multiple calls to Recv.
std::queue< Ptr< Packet > > m_deliveryQueue
receive buffer
bool Accept(void)
Accept an incoming connection.
virtual uint32_t GetDelAckMaxCount(void) const
Get the number of packet to fire an ACK before delay timeout.
virtual bool GetAllowBroadcast() const
Query whether broadcast datagram transmissions are allowed.
void Destroy(void)
Kill this socket by zeroing its attributes (IPv4)
virtual int ShutdownSend(void)
void SetTcp(Ptr< NscTcpL4Protocol > tcp)
Set the associated TCP L4 protocol.
friend class Tcp
Tcp friend class.
virtual Ptr< Node > GetNode(void) const
Return the node this socket is associated with.
void SetNode(Ptr< Node > node)
Set the associated node.
A representation of an internet endpoint/connection.
uint32_t m_segmentSize
SegmentSize.
virtual void SetDataRetries(uint32_t retries)
Set the number of data transmission retries before giving up.
InetSocketAddress m_peerAddress
peer IP and port
uint32_t m_synRetries
Count of remaining connection retries.
uint32_t m_rxWindowSize
Receive window size.
int FinishBind(void)
Finish the binding process.
virtual void SetConnTimeout(Time timeout)
Set the connection timeout.
virtual void SetPersistTimeout(Time timeout)
Set the timeout for persistent connection.
Time m_cnTimeout
Timeout for connection retry.
virtual uint32_t GetDataRetries(void) const
Get the number of data transmission retries before giving up.