A Discrete-Event Network Simulator
API
nsc-tcp-socket-impl.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License version 2 as
5  * published by the Free Software Foundation;
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software
14  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15  *
16  * based on tcp-socket-impl.cc, Author: Raj Bhattacharjea <raj.b@gatech.edu>
17  * Author: Florian Westphal <fw@strlen.de>
18  */
19 
20 #define NS_LOG_APPEND_CONTEXT \
21  if (m_node) { std::clog << Simulator::Now ().As (Time::S) << " [node " << m_node->GetId () << "] "; }
22 
23 #include "ns3/node.h"
24 #include "ns3/inet-socket-address.h"
25 #include "ns3/log.h"
26 #include "ns3/ipv4.h"
27 #include "ipv4-end-point.h"
28 #include "nsc-tcp-l4-protocol.h"
29 #include "nsc-tcp-socket-impl.h"
30 #include "ns3/simulation-singleton.h"
31 #include "ns3/simulator.h"
32 #include "ns3/packet.h"
33 #include "ns3/uinteger.h"
34 #include "ns3/trace-source-accessor.h"
35 
36 #include <algorithm>
37 
38 // for ntohs().
39 #include <arpa/inet.h>
40 #include <netinet/in.h>
41 #include "sim_interface.h"
42 
43 #include "sim_errno.h"
44 
45 
46 namespace ns3 {
47 
48 NS_LOG_COMPONENT_DEFINE ("NscTcpSocketImpl");
49 
50 NS_OBJECT_ENSURE_REGISTERED (NscTcpSocketImpl);
51 
52 TypeId
54 {
55  static TypeId tid = TypeId ("ns3::NscTcpSocketImpl")
56  .SetParent<TcpSocket> ()
57  .SetGroupName ("Internet")
58  .AddTraceSource ("CongestionWindow",
59  "The TCP connection's congestion window",
61  "ns3::TracedValueCallback::Uint32")
62  .AddTraceSource ("SlowStartThreshold",
63  "TCP slow start threshold (bytes)",
65  "ns3::TracedValueCallback::Uint32")
66  .AddTraceSource ("State",
67  "TCP state",
69  "ns3::TcpStatesTracedValueCallback")
70  ;
71  return tid;
72 }
73 
75  : m_endPoint (0),
76  m_node (0),
77  m_tcp (0),
78  m_localAddress (Ipv4Address::GetZero ()),
79  m_localPort (0),
80  m_peerAddress ("0.0.0.0", 0),
81  m_errno (ERROR_NOTERROR),
82  m_shutdownSend (false),
83  m_shutdownRecv (false),
84  m_connected (false),
85  m_state (CLOSED),
86  m_closeOnEmpty (false),
87  m_txBufferSize (0),
88  m_lastMeasuredRtt (Seconds (0.0))
89 {
90  NS_LOG_FUNCTION (this);
91 }
92 
94  : TcpSocket (sock), //copy the base class callbacks
95  m_delAckMaxCount (sock.m_delAckMaxCount),
96  m_delAckTimeout (sock.m_delAckTimeout),
97  m_noDelay (sock.m_noDelay),
98  m_endPoint (0),
99  m_node (sock.m_node),
100  m_tcp (sock.m_tcp),
101  m_remoteAddress (sock.m_remoteAddress),
102  m_remotePort (sock.m_remotePort),
103  m_localAddress (sock.m_localAddress),
104  m_localPort (sock.m_localPort),
105  m_peerAddress (sock.m_peerAddress),
106  m_errno (sock.m_errno),
107  m_shutdownSend (sock.m_shutdownSend),
108  m_shutdownRecv (sock.m_shutdownRecv),
109  m_connected (sock.m_connected),
110  m_state (sock.m_state),
111  m_closeOnEmpty (sock.m_closeOnEmpty),
112  m_txBufferSize (sock.m_txBufferSize),
113  m_segmentSize (sock.m_segmentSize),
114  m_rxWindowSize (sock.m_rxWindowSize),
115  m_advertisedWindowSize (sock.m_advertisedWindowSize),
116  m_cWnd (sock.m_cWnd),
117  m_ssThresh (sock.m_ssThresh),
118  m_initialCWnd (sock.m_initialCWnd),
119  m_initialSsThresh (sock.m_initialSsThresh),
120  m_lastMeasuredRtt (Seconds (0.0)),
121  m_cnTimeout (sock.m_cnTimeout),
122  m_synRetries (sock.m_synRetries),
123  m_rxAvailable (0),
124  m_nscTcpSocket (0),
125  m_sndBufSize (sock.m_sndBufSize)
126 {
127  NS_LOG_FUNCTION (this);
128  NS_LOG_LOGIC ("Invoked the copy constructor");
129  //copy the pending data if necessary
130  if(!sock.m_txBuffer.empty () )
131  {
132  m_txBuffer = sock.m_txBuffer;
133  }
134  //can't "copy" the endpoint just yes, must do this when we know the peer info
135  //too; this is in SYN_ACK_TX
136 }
137 
139 {
140  NS_LOG_FUNCTION (this);
141  m_node = 0;
142  if (m_endPoint != 0)
143  {
144  NS_ASSERT (m_tcp != 0);
153  NS_ASSERT (m_endPoint != 0);
154  m_tcp->DeAllocate (m_endPoint);
155  NS_ASSERT (m_endPoint == 0);
156  }
157  m_tcp = 0;
158 }
159 
160 void
162 {
163  m_node = node;
164  // Initialize some variables
168 }
169 
170 void
172 {
173  m_nscTcpSocket = tcp->m_nscStack->new_tcp_socket ();
174  m_tcp = tcp;
175 }
176 
177 
179 NscTcpSocketImpl::GetErrno (void) const
180 {
181  NS_LOG_FUNCTION (this);
182  return m_errno;
183 }
184 
187 {
188  return NS3_SOCK_STREAM;
189 }
190 
191 Ptr<Node>
193 {
194  NS_LOG_FUNCTION (this);
195  return m_node;
196 }
197 
198 void
200 {
201  NS_LOG_FUNCTION (this);
202  m_node = 0;
203  m_endPoint = 0;
204  m_tcp = 0;
205 }
206 int
208 {
209  NS_LOG_FUNCTION (this);
210  if (m_endPoint == 0)
211  {
212  return -1;
213  }
218  return 0;
219 }
220 
221 int
223 {
224  NS_LOG_FUNCTION (this);
225  m_endPoint = m_tcp->Allocate ();
226  return FinishBind ();
227 }
228 int
230 {
231  NS_LOG_LOGIC ("NscTcpSocketImpl: ERROR_AFNOSUPPORT - Bind6 not supported");
233  return (-1);
234 }
235 int
237 {
238  NS_LOG_FUNCTION (this<<address);
240  {
241  return ERROR_INVAL;
242  }
244  Ipv4Address ipv4 = transport.GetIpv4 ();
245  uint16_t port = transport.GetPort ();
246  if (ipv4 == Ipv4Address::GetAny () && port == 0)
247  {
248  m_endPoint = m_tcp->Allocate ();
249  NS_LOG_LOGIC ("NscTcpSocketImpl "<<this<<" got an endpoint: "<<m_endPoint);
250  }
251  else if (ipv4 == Ipv4Address::GetAny () && port != 0)
252  {
253  m_endPoint = m_tcp->Allocate (GetBoundNetDevice (), port);
254  NS_LOG_LOGIC ("NscTcpSocketImpl "<<this<<" got an endpoint: "<<m_endPoint);
255  }
256  else if (ipv4 != Ipv4Address::GetAny () && port == 0)
257  {
258  m_endPoint = m_tcp->Allocate (ipv4);
259  NS_LOG_LOGIC ("NscTcpSocketImpl "<<this<<" got an endpoint: "<<m_endPoint);
260  }
261  else if (ipv4 != Ipv4Address::GetAny () && port != 0)
262  {
263  m_endPoint = m_tcp->Allocate (GetBoundNetDevice (), ipv4, port);
264  NS_LOG_LOGIC ("NscTcpSocketImpl "<<this<<" got an endpoint: "<<m_endPoint);
265  }
266 
267  m_localPort = port;
268  return FinishBind ();
269 }
270 
271 /* Inherit from Socket class: Bind this socket to the specified NetDevice */
272 void
274 {
275  NS_LOG_FUNCTION (this << netdevice);
276  Socket::BindToNetDevice (netdevice); // Includes sanity check
277  if (m_endPoint != 0)
278  {
279  m_endPoint->BindToNetDevice (netdevice);
280  }
281  return;
282 }
283 
284 int
286 {
287  NS_LOG_FUNCTION (this);
288  m_shutdownSend = true;
289  return 0;
290 }
291 int
293 {
294  NS_LOG_FUNCTION (this);
295  m_shutdownRecv = true;
296  return 0;
297 }
298 
299 int
301 {
302  NS_LOG_FUNCTION (this << m_state);
303 
304  if (m_state == CLOSED)
305  {
306  return -1;
307  }
308  if (!m_txBuffer.empty ())
309  { // App close with pending data must wait until all data transmitted
310  m_closeOnEmpty = true;
311  NS_LOG_LOGIC ("Socket " << this <<
312  " deferring close, state " << m_state);
313  return 0;
314  }
315 
316  NS_LOG_LOGIC ("NscTcp socket " << this << " calling disconnect(); moving to CLOSED");
318  m_state = CLOSED;
319  ShutdownSend ();
320  return 0;
321 }
322 
323 int
325 {
326  NS_LOG_FUNCTION (this << address);
327  if (m_endPoint == 0)
328  {
329  if (Bind () == -1)
330  {
331  NS_ASSERT (m_endPoint == 0);
332  return -1;
333  }
334  NS_ASSERT (m_endPoint != 0);
335  }
337  m_remoteAddress = transport.GetIpv4 ();
338  m_remotePort = transport.GetPort ();
339 
340  std::ostringstream ss;
341  m_remoteAddress.Print (ss);
342  std::string ipstring = ss.str ();
343 
344  m_nscTcpSocket->connect (ipstring.c_str (), m_remotePort);
345  m_state = SYN_SENT;
346  return 0;
347 }
348 
349 int
350 NscTcpSocketImpl::Send (const Ptr<Packet> p, uint32_t flags)
351 {
352  NS_LOG_FUNCTION (this << p);
353 
354  NS_ASSERT (p->GetSize () > 0);
356  {
357  if (p->GetSize () > GetTxAvailable ())
358  {
360  return -1;
361  }
362 
363  uint32_t sent = p->GetSize ();
364  if (m_state == ESTABLISHED)
365  {
366  m_txBuffer.push (p);
367  m_txBufferSize += sent;
368  SendPendingData ();
369  }
370  else
371  { // SYN_SET -- Queue Data
372  m_txBuffer.push (p);
373  m_txBufferSize += sent;
374  }
375  return sent;
376  }
377  else
378  {
380  return -1;
381  }
382 }
383 
384 int
386 {
387  NS_LOG_FUNCTION (this << address << p);
388  if (!m_connected)
389  {
391  return -1;
392  }
393  else
394  {
395  return Send (p, flags); //drop the address according to BSD manpages
396  }
397 }
398 
399 uint32_t
401 {
402  NS_LOG_FUNCTION (this);
403  if (m_txBufferSize != 0)
404  {
406  return m_sndBufSize - m_txBufferSize;
407  }
408  else
409  {
410  return m_sndBufSize;
411  }
412 }
413 
414 int
416 {
417  NS_LOG_FUNCTION (this);
419  m_state = LISTEN;
420  return 0;
421 }
422 
423 
424 void
426 {
427  NS_LOG_FUNCTION (this);
428  switch (m_state) {
429  case SYN_SENT:
430  if (!m_nscTcpSocket->is_connected ())
431  break;
434  // fall through to schedule read/write events
435  case ESTABLISHED:
436  if (!m_txBuffer.empty ())
437  {
439  }
440  else
441  {
442  if (GetTxAvailable ())
443  {
445  }
446  }
448  break;
449  case LISTEN:
451  break;
452  case CLOSED: break;
453  default:
454  NS_LOG_DEBUG (this << " invalid state: " << m_state);
455  }
456 }
457 
459 NscTcpSocketImpl::Recv (uint32_t maxSize, uint32_t flags)
460 {
461  NS_LOG_FUNCTION (this << maxSize << flags);
462  if (m_deliveryQueue.empty () )
463  {
465  return 0;
466  }
467  Ptr<Packet> p = m_deliveryQueue.front ();
468  if (p->GetSize () <= maxSize)
469  {
470  m_deliveryQueue.pop ();
471  m_rxAvailable -= p->GetSize ();
472  }
473  else
474  {
476  p = 0;
477  }
478  return p;
479 }
480 
482 NscTcpSocketImpl::RecvFrom (uint32_t maxSize, uint32_t flags,
483  Address &fromAddress)
484 {
485  NS_LOG_FUNCTION (this << maxSize << flags);
486  Ptr<Packet> packet = Recv (maxSize, flags);
487  GetPeerName (fromAddress);
488  return packet;
489 }
490 
491 int
493 {
494  NS_LOG_FUNCTION (this << address);
496  return 0;
497 }
498 
499 int
501 {
502  NS_LOG_FUNCTION (this << address);
503 
504  if (!m_endPoint)
505  {
507  return -1;
508  }
510  m_endPoint->GetPeerPort ());
511  return 0;
512 }
513 
514 uint32_t
516 {
517  NS_LOG_FUNCTION (this);
518  // We separately maintain this state to avoid walking the queue
519  // every time this might be called
520  return m_rxAvailable;
521 }
522 
523 void
525  Ptr<Ipv4Interface> incomingInterface)
526 {
527  NSCWakeup ();
528 }
529 
531 {
532  // The address pairs (m_localAddress, m_localPort, m_remoteAddress, m_remotePort)
533  // are bogus, but this isn't important at the moment, because
534  // address <-> Socket handling is done by NSC internally.
535  // We only need to add the new ns-3 socket to the list of sockets, so
536  // we use plain Allocate() instead of Allocate(m_localAddress, ... )
537  struct sockaddr_in sin;
538  size_t sin_len = sizeof(sin);
539 
540  if (0 == m_nscTcpSocket->getpeername ((struct sockaddr*) &sin, &sin_len)) {
541  m_remotePort = ntohs (sin.sin_port);
542  m_remoteAddress = Ipv4Address::Deserialize ((const uint8_t*) &sin.sin_addr);
544  }
545 
546  m_endPoint = m_tcp->Allocate ();
547 
548  //the cloned socket with be in listen state, so manually change state
549  NS_ASSERT (m_state == LISTEN);
551 
552  sin_len = sizeof(sin);
553 
554  if (0 == m_nscTcpSocket->getsockname ((struct sockaddr *) &sin, &sin_len))
555  m_localAddress = Ipv4Address::Deserialize ((const uint8_t*) &sin.sin_addr);
556 
557  NS_LOG_LOGIC ("NscTcpSocketImpl " << this << " accepted connection from "
558  << m_remoteAddress << ":" << m_remotePort
559  << " to " << m_localAddress << ":" << m_localPort);
560  //equivalent to FinishBind
563 
565 }
566 
568 { // We would preferred to have scheduled an event directly to
569  // NotifyConnectionSucceeded, but (sigh) these are protected
570  // and we can get the address of it :(
571  struct sockaddr_in sin;
572  size_t sin_len = sizeof(sin);
573  if (0 == m_nscTcpSocket->getsockname ((struct sockaddr *) &sin, &sin_len)) {
574  m_localAddress = Ipv4Address::Deserialize ((const uint8_t*)&sin.sin_addr);
575  m_localPort = ntohs (sin.sin_port);
576  }
577 
578  NS_LOG_LOGIC ("NscTcpSocketImpl " << this << " connected to "
579  << m_remoteAddress << ":" << m_remotePort
580  << " from " << m_localAddress << ":" << m_localPort);
582 }
583 
584 
586 {
587  if (m_state == CLOSED)
588  { // Happens if application closes listening socket after Accept() was scheduled.
589  return false;
590  }
591  NS_ASSERT (m_state == LISTEN);
592 
593  if (!m_nscTcpSocket->is_listening ())
594  {
595  return false;
596  }
597  INetStreamSocket *newsock;
598  int res = m_nscTcpSocket->accept (&newsock);
599  if (res != 0)
600  {
601  return false;
602  }
603 // We could obtain a fromAddress using getpeername, but we've already
604 // finished the tcp handshake here, i.e. this is a new connection
605 // and not a connection request.
606 // if (!NotifyConnectionRequest(fromAddress))
607 // return true;
608 
609  // Clone the socket
610  Ptr<NscTcpSocketImpl> newSock = Copy ();
611  newSock->m_nscTcpSocket = newsock;
612  NS_LOG_LOGIC ("Cloned a NscTcpSocketImpl " << newSock);
613 
615  return true;
616 }
617 
619 {
620  if (m_state != ESTABLISHED)
621  {
622  return false;
623  }
624  int len, err;
625  uint8_t buffer[8192];
626  len = sizeof(buffer);
628  err = m_nscTcpSocket->read_data (buffer, &len);
629  if (err == 0 && len == 0)
630  {
631  NS_LOG_LOGIC ("ReadPendingData got EOF from socket");
633  return false;
634  }
635  m_errno = GetNativeNs3Errno (err);
636  switch (m_errno)
637  {
638  case ERROR_NOTERROR: break; // some data was sent
639  case ERROR_AGAIN: return false;
640  default:
641  NS_LOG_WARN ("Error (" << err << ") " <<
642  "during read_data, ns-3 errno set to" << m_errno);
643  m_state = CLOSED;
644  return false;
645  }
646 
647  Ptr<Packet> p = Create<Packet> (buffer, len);
648 
649  m_deliveryQueue.push (p);
650  m_rxAvailable += p->GetSize ();
651 
652  NotifyDataRecv ();
653  return true;
654 }
655 
657 {
658  NS_LOG_FUNCTION (this);
659  NS_LOG_LOGIC ("ENTERING SendPendingData");
660 
661  if (m_txBuffer.empty ())
662  {
663  return false;
664  }
665 
666  int ret;
667  size_t size, written = 0;
668 
669  do {
670  NS_ASSERT (!m_txBuffer.empty ());
671  Ptr<Packet> &p = m_txBuffer.front ();
672  size = p->GetSize ();
673  NS_ASSERT (size > 0);
674 
676 
677  uint8_t *buf = new uint8_t[size];
678  p->CopyData (buf, size);
679  ret = m_nscTcpSocket->send_data ((const char *)buf, size);
680  delete[] buf;
681 
682  if (ret <= 0)
683  {
684  break;
685  }
686  written += ret;
687 
688  NS_ASSERT (m_txBufferSize >= (size_t)ret);
689  m_txBufferSize -= ret;
690 
691  if ((size_t)ret < size)
692  {
693  p->RemoveAtStart (ret);
694  break;
695  }
696 
697  m_txBuffer.pop ();
698 
699  if (m_txBuffer.empty ())
700  {
701  if (m_closeOnEmpty)
702  {
704  m_state = CLOSED;
705  }
706  break;
707  }
708  } while ((size_t) ret == size);
709 
710  if (written > 0)
711  {
712  NS_LOG_DEBUG ("Notifying data sent, remaining txbuffer size: " << m_txBufferSize);
714  return true;
715  }
716  else
717  {
718  NS_LOG_DEBUG ("Not notifying data sent, return value " << ret);
719  }
720  return false;
721 }
722 
724 {
725  return CopyObject<NscTcpSocketImpl> (this);
726 }
727 
728 void
730 {
731  m_sndBufSize = size;
732 }
733 
734 uint32_t
736 {
737  return m_sndBufSize;
738 }
739 
740 void
742 {
743  m_rcvBufSize = size;
744 }
745 
746 uint32_t
748 {
749  return m_rcvBufSize;
750 }
751 
752 void
754 {
755  m_segmentSize = size;
756 }
757 
758 uint32_t
760 {
761  return m_segmentSize;
762 }
763 
764 void
766 {
768 }
769 
770 uint32_t
772 {
773  return m_advertisedWindowSize;
774 }
775 
776 void
778 {
779  m_initialSsThresh = threshold;
780 }
781 
782 uint32_t
784 {
785  return m_initialSsThresh;
786 }
787 
788 void
790 {
791  m_initialCWnd = cwnd;
792 }
793 
794 uint32_t
796 {
797  return m_initialCWnd;
798 }
799 
800 void
802 {
804 }
805 
806 Time
808 {
809  return m_cnTimeout;
810 }
811 
812 void
814 {
815  m_synRetries = count;
816 }
817 
818 uint32_t
820 {
821  return m_synRetries;
822 }
823 
824 void
826 {
828 }
829 
830 void
832 {
833  NS_LOG_FUNCTION (this << retries);
834  m_dataRetries = retries;
835 }
836 
837 uint32_t
839 {
840  NS_LOG_FUNCTION (this);
841  return m_dataRetries;
842 }
843 
844 Time
846 {
847  return m_delAckTimeout;
848 }
849 
850 void
852 {
853  m_delAckMaxCount = count;
854 }
855 
856 uint32_t
858 {
859  return m_delAckMaxCount;
860 }
861 
862 void
864 {
865  m_noDelay = noDelay;
866 }
867 
868 bool
870 {
871  return m_noDelay;
872 }
873 
874 void
876 {
878 }
879 
880 Time
882 {
883  return m_persistTimeout;
884 }
885 
887 NscTcpSocketImpl::GetNativeNs3Errno (int error) const
888 {
889  enum nsc_errno err;
890 
891  if (error >= 0)
892  {
893  return ERROR_NOTERROR;
894  }
895  err = (enum nsc_errno) error;
896  switch (err)
897  {
898  case NSC_EADDRINUSE: // fallthrough
900  case NSC_EINPROGRESS: // Although nsc sockets are nonblocking, we pretend they're not.
901  case NSC_EAGAIN: return ERROR_AGAIN;
902  case NSC_EISCONN: // fallthrough
903  case NSC_EALREADY: return ERROR_ISCONN;
905  case NSC_ECONNRESET: // for no, all of these fall through
906  case NSC_EHOSTDOWN:
907  case NSC_ENETUNREACH:
909  case NSC_EMSGSIZE: return ERROR_MSGSIZE;
910  case NSC_ENOTCONN: return ERROR_NOTCONN;
911  case NSC_ESHUTDOWN: return ERROR_SHUTDOWN;
912  case NSC_ETIMEDOUT: return ERROR_NOTCONN;
913  case NSC_ENOTDIR: // used by eg. sysctl(2). Shouldn't happen normally,
914  // but is triggered by e.g. show_config().
915  case NSC_EUNKNOWN: return ERROR_INVAL; // Catches stacks that 'return -1' without real mapping
916  }
917  NS_ASSERT_MSG (0, "Unknown NSC error");
918  return ERROR_INVAL;
919 }
920 
921 bool
923 {
924  if (allowBroadcast)
925  {
926  return false;
927  }
928  return true;
929 }
930 
931 bool
933 {
934  return false;
935 }
936 
937 } // namespace ns3
ns3::NscTcpSocketImpl::m_closeOnEmpty
bool m_closeOnEmpty
true if socket will close when buffer is empty
Definition: nsc-tcp-socket-impl.h:241
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
ns3::Socket::NotifyConnectionSucceeded
void NotifyConnectionSucceeded(void)
Notify through the callback (if set) that the connection has been established.
Definition: socket.cc:217
ns3::TcpSocket::SYN_SENT
@ SYN_SENT
Sent a connection request, waiting for ack
Definition: tcp-socket.h:68
ns3::Ipv4Header
Packet header for IPv4.
Definition: ipv4-header.h:34
ns3::InetSocketAddress
an Inet address class
Definition: inet-socket-address.h:41
ns3::Socket::ERROR_MSGSIZE
@ ERROR_MSGSIZE
Definition: socket.h:86
ns3::NscTcpSocketImpl::RecvFrom
virtual Ptr< Packet > RecvFrom(uint32_t maxSize, uint32_t flags, Address &fromAddress)
Read a single packet from the socket and retrieve the sender address.
Definition: nsc-tcp-socket-impl.cc:482
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
NS_ASSERT
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:67
ns3::InetSocketAddress::IsMatchingType
static bool IsMatchingType(const Address &address)
Definition: inet-socket-address.cc:103
ns3::NscTcpSocketImpl::m_initialCWnd
uint32_t m_initialCWnd
Initial cWnd value.
Definition: nsc-tcp-socket-impl.h:253
NSC_EHOSTDOWN
@ NSC_EHOSTDOWN
Definition: sim_errno.h:49
ns3::Packet::GetSize
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:852
ns3::Socket::SocketErrno
SocketErrno
Enumeration of the possible errors returned by a socket.
Definition: socket.h:82
ns3::InetSocketAddress::GetPort
uint16_t GetPort(void) const
Definition: inet-socket-address.cc:65
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::NscTcpSocketImpl::GetAdvWin
virtual uint32_t GetAdvWin(void) const
Get the Advertised Window size.
Definition: nsc-tcp-socket-impl.cc:771
INetStreamSocket::getsockname
virtual int getsockname(struct sockaddr *sa, size_t *salen)
Get the socket local name.
Definition: sim_interface.h:343
ns3::NscTcpSocketImpl::Close
virtual int Close(void)
Close a socket.
Definition: nsc-tcp-socket-impl.cc:300
ns3::NscTcpSocketImpl::m_rxAvailable
uint32_t m_rxAvailable
receive buffer available size
Definition: nsc-tcp-socket-impl.h:267
ns3::Socket::Recv
Ptr< Packet > Recv(void)
Read a single packet from the socket.
Definition: socket.cc:175
ns3::NscTcpSocketImpl::m_rcvBufSize
uint32_t m_rcvBufSize
maximum receive socket buffer size
Definition: nsc-tcp-socket-impl.h:272
ns3::NscTcpSocketImpl::GetInitialSSThresh
virtual uint32_t GetInitialSSThresh(void) const
Get the initial Slow Start Threshold.
Definition: nsc-tcp-socket-impl.cc:783
ns3::NscTcpSocketImpl::m_localAddress
Ipv4Address m_localAddress
local address
Definition: nsc-tcp-socket-impl.h:231
ns3::NscTcpSocketImpl::m_connected
bool m_connected
Connection established.
Definition: nsc-tcp-socket-impl.h:237
ns3::Socket::ERROR_AGAIN
@ ERROR_AGAIN
Definition: socket.h:87
ns3::NscTcpSocketImpl::m_sndBufSize
uint32_t m_sndBufSize
buffer limit for the outgoing queue
Definition: nsc-tcp-socket-impl.h:271
ns3::NscTcpSocketImpl::Bind6
virtual int Bind6(void)
Allocate a local IPv6 endpoint for this socket.
Definition: nsc-tcp-socket-impl.cc:229
NSC_ENETUNREACH
@ NSC_ENETUNREACH
Definition: sim_errno.h:54
NSC_EAGAIN
@ NSC_EAGAIN
Definition: sim_errno.h:45
ns3::Socket::ERROR_SHUTDOWN
@ ERROR_SHUTDOWN
Definition: socket.h:88
ns3::Ipv4EndPoint::BindToNetDevice
void BindToNetDevice(Ptr< NetDevice > netdevice)
Bind a socket to specific device.
Definition: ipv4-end-point.cc:96
ns3::NscTcpSocketImpl::~NscTcpSocketImpl
virtual ~NscTcpSocketImpl()
Definition: nsc-tcp-socket-impl.cc:138
NS_LOG_WARN
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Definition: log.h:265
INetStreamSocket::disconnect
virtual void disconnect()=0
Disconnect from a remote peer.
ns3::Packet::CopyData
uint32_t CopyData(uint8_t *buffer, uint32_t size) const
Copy the packet contents to a byte buffer.
Definition: packet.cc:378
ns3::Ipv4Address
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:41
ns3::NscTcpSocketImpl::BindToNetDevice
virtual void BindToNetDevice(Ptr< NetDevice > netdevice)
Bind a socket to specific device.
Definition: nsc-tcp-socket-impl.cc:273
ns3::NscTcpSocketImpl::m_txBufferSize
uint32_t m_txBufferSize
transmission buffer size
Definition: nsc-tcp-socket-impl.h:245
INetStreamSocket::connect
virtual void connect(const char *, int)=0
Connect to a remote peer.
ns3::NscTcpSocketImpl::GetConnTimeout
virtual Time GetConnTimeout(void) const
Get the connection timeout.
Definition: nsc-tcp-socket-impl.cc:807
ns3::NscTcpSocketImpl::m_persistTimeout
Time m_persistTimeout
Time between sending 1-byte probes.
Definition: nsc-tcp-socket-impl.h:263
ns3::NscTcpSocketImpl::m_cWnd
TracedValue< uint32_t > m_cWnd
Congestion window.
Definition: nsc-tcp-socket-impl.h:251
INetStreamSocket::is_connected
virtual bool is_connected()=0
Check the connection state.
ns3::NscTcpSocketImpl::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition: nsc-tcp-socket-impl.cc:53
ns3::NscTcpSocketImpl::GetPeerName
virtual int GetPeerName(Address &address) const
Get the peer address of a connected socket.
Definition: nsc-tcp-socket-impl.cc:500
ns3::NscTcpSocketImpl::SetSndBufSize
virtual void SetSndBufSize(uint32_t size)
Set the send buffer size.
Definition: nsc-tcp-socket-impl.cc:729
NSC_ECONNREFUSED
@ NSC_ECONNREFUSED
Definition: sim_errno.h:47
ns3::NscTcpSocketImpl::m_dataRetries
uint32_t m_dataRetries
Count of remaining data retransmission attempts.
Definition: nsc-tcp-socket-impl.h:262
INetStreamSocket::is_listening
virtual bool is_listening()=0
Check the listening state.
ns3::InetSocketAddress::ConvertFrom
static InetSocketAddress ConvertFrom(const Address &address)
Returns an InetSocketAddress which corresponds to the input Address.
Definition: inet-socket-address.cc:126
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:923
ns3::Socket::ERROR_AFNOSUPPORT
@ ERROR_AFNOSUPPORT
Definition: socket.h:90
ns3::NscTcpSocketImpl::GetSocketType
virtual enum SocketType GetSocketType(void) const
Definition: nsc-tcp-socket-impl.cc:186
ns3::MakeTraceSourceAccessor
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Definition: trace-source-accessor.h:202
ns3::NscTcpSocketImpl::SetSynRetries
virtual void SetSynRetries(uint32_t count)
Set the number of connection retries before giving up.
Definition: nsc-tcp-socket-impl.cc:813
ns3::NscTcpSocketImpl::ForwardUp
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.
Definition: nsc-tcp-socket-impl.cc:524
NSC_EINPROGRESS
@ NSC_EINPROGRESS
Definition: sim_errno.h:51
ns3::NscTcpSocketImpl::SetInitialSSThresh
virtual void SetInitialSSThresh(uint32_t threshold)
Set the initial Slow Start Threshold.
Definition: nsc-tcp-socket-impl.cc:777
nsc-tcp-socket-impl.h
INetStreamSocket::listen
virtual void listen(int)=0
Put the socket in Listening state on a port.
NSC_EUNKNOWN
@ NSC_EUNKNOWN
Definition: sim_errno.h:42
ns3::NscTcpSocketImpl::SetSegSize
virtual void SetSegSize(uint32_t size)
Set the segment size.
Definition: nsc-tcp-socket-impl.cc:753
ns3::NscTcpSocketImpl::GetSockName
virtual int GetSockName(Address &address) const
Get socket address.
Definition: nsc-tcp-socket-impl.cc:492
ns3::Ipv4Address::Deserialize
static Ipv4Address Deserialize(const uint8_t buf[4])
Definition: ipv4-address.cc:322
ns3::NscTcpSocketImpl::ReadPendingData
bool ReadPendingData(void)
Read all the pending data.
Definition: nsc-tcp-socket-impl.cc:618
ns3::Ptr< Node >
ns3::NscTcpSocketImpl::GetInitialCwnd
virtual uint32_t GetInitialCwnd(void) const
Get the initial Congestion Window.
Definition: nsc-tcp-socket-impl.cc:795
ns3::Socket::ERROR_INVAL
@ ERROR_INVAL
Definition: socket.h:91
ns3::NscTcpSocketImpl::m_delAckTimeout
Time m_delAckTimeout
Time to delay an ACK.
Definition: nsc-tcp-socket-impl.h:222
ns3::NscTcpSocketImpl::m_noDelay
bool m_noDelay
Disable ACk delay.
Definition: nsc-tcp-socket-impl.h:223
ns3::Ipv4EndPoint::GetLocalPort
uint16_t GetLocalPort(void)
Get the local port.
Definition: ipv4-end-point.cc:67
ns3::TcpSocket::CLOSE_WAIT
@ CLOSE_WAIT
Remote side has shutdown and is waiting for us to finish writing our data and to shutdown (we have to...
Definition: tcp-socket.h:72
ns3::NscTcpSocketImpl::m_remoteAddress
Ipv4Address m_remoteAddress
peer IP address
Definition: nsc-tcp-socket-impl.h:228
INetStreamSocket::accept
virtual int accept(INetStreamSocket **handler)=0
Accept an incoming connection.
ns3::NscTcpSocketImpl::ShutdownRecv
virtual int ShutdownRecv(void)
Definition: nsc-tcp-socket-impl.cc:292
ns3::TcpSocket::ESTABLISHED
@ ESTABLISHED
Connection established
Definition: tcp-socket.h:71
ns3::Packet::RemoveAtStart
void RemoveAtStart(uint32_t size)
Remove size bytes from the start of the current packet.
Definition: packet.cc:362
ipv4-end-point.h
ns3::NscTcpSocketImpl::m_initialSsThresh
uint32_t m_initialSsThresh
Initial Slow Start Threshold.
Definition: nsc-tcp-socket-impl.h:254
ns3::Address
a polymophic address class
Definition: address.h:91
ns3::NscTcpSocketImpl::SetRcvBufSize
virtual void SetRcvBufSize(uint32_t size)
Set the receive buffer size.
Definition: nsc-tcp-socket-impl.cc:741
ns3::NscTcpSocketImpl::NscTcpSocketImpl
NscTcpSocketImpl()
Create an unbound tcp socket.
Definition: nsc-tcp-socket-impl.cc:74
ns3::NscTcpSocketImpl::m_nscTcpSocket
INetStreamSocket * m_nscTcpSocket
the real NSC TCP socket
Definition: nsc-tcp-socket-impl.h:268
ns3::NscTcpSocketImpl::GetTcpNoDelay
virtual bool GetTcpNoDelay(void) const
Check if Nagle's algorithm is enabled or not.
Definition: nsc-tcp-socket-impl.cc:869
ns3::NscTcpSocketImpl::SetTcpNoDelay
virtual void SetTcpNoDelay(bool noDelay)
Enable/Disable Nagle's algorithm.
Definition: nsc-tcp-socket-impl.cc:863
ns3::TcpSocket
(abstract) base class of all TcpSockets
Definition: tcp-socket.h:48
ns3::InetSocketAddress::GetIpv4
Ipv4Address GetIpv4(void) const
Definition: inet-socket-address.cc:71
ns3::NscTcpSocketImpl::m_ssThresh
TracedValue< uint32_t > m_ssThresh
Slow Start Threshold.
Definition: nsc-tcp-socket-impl.h:252
ns3::NscTcpSocketImpl::SetDelAckMaxCount
virtual void SetDelAckMaxCount(uint32_t count)
Set the number of packet to fire an ACK before delay timeout.
Definition: nsc-tcp-socket-impl.cc:851
ns3::NscTcpSocketImpl::SetAdvWin
virtual void SetAdvWin(uint32_t window)
Set the Advertised Window size.
Definition: nsc-tcp-socket-impl.cc:765
ns3::NscTcpSocketImpl::m_txBuffer
std::queue< Ptr< Packet > > m_txBuffer
transmission buffer
Definition: nsc-tcp-socket-impl.h:244
sim_interface.h
NSC_ESHUTDOWN
@ NSC_ESHUTDOWN
Definition: sim_errno.h:57
ns3::Socket::SocketType
SocketType
Enumeration of the possible socket types.
Definition: socket.h:104
ns3::NscTcpSocketImpl::m_delAckMaxCount
uint32_t m_delAckMaxCount
Number of packet to fire an ACK before delay timeout.
Definition: nsc-tcp-socket-impl.h:221
ns3::Socket::ERROR_NOTCONN
@ ERROR_NOTCONN
Definition: socket.h:85
ns3::NscTcpSocketImpl::m_errno
enum SocketErrno m_errno
last error number
Definition: nsc-tcp-socket-impl.h:234
ns3::TcpSocket::LISTEN
@ LISTEN
Listening for a connection
Definition: tcp-socket.h:67
ns3::NscTcpSocketImpl::GetTxAvailable
virtual uint32_t GetTxAvailable(void) const
Returns the number of bytes which can be sent in a single call to Send.
Definition: nsc-tcp-socket-impl.cc:400
ns3::TcpSocket::CLOSED
@ CLOSED
Socket is finished
Definition: tcp-socket.h:66
ns3::Socket::ERROR_NOTERROR
@ ERROR_NOTERROR
Definition: socket.h:83
ns3::Socket::GetBoundNetDevice
Ptr< NetDevice > GetBoundNetDevice()
Returns socket's bound NetDevice, if any.
Definition: socket.cc:351
NSC_EADDRINUSE
@ NSC_EADDRINUSE
Definition: sim_errno.h:43
NSC_EISCONN
@ NSC_EISCONN
Definition: sim_errno.h:52
first.address
address
Definition: first.py:44
ns3::Ipv4EndPoint::GetLocalAddress
Ipv4Address GetLocalAddress(void)
Get the local address.
Definition: ipv4-end-point.cc:53
nsc_errno
nsc_errno
List of network stack errors that may happen in a simulation, and can be handled by the simulator in ...
Definition: sim_errno.h:41
ns3::NscTcpSocketImpl::m_state
TracedValue< TcpStates_t > m_state
state information
Definition: nsc-tcp-socket-impl.h:240
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
ns3::NscTcpSocketImpl
Socket logic for the NSC TCP sockets.
Definition: nsc-tcp-socket-impl.h:54
ns3::NscTcpSocketImpl::SendTo
virtual int SendTo(Ptr< Packet > p, uint32_t flags, const Address &toAddress)
Send data to a specified peer.
Definition: nsc-tcp-socket-impl.cc:385
ns3::NscTcpSocketImpl::GetRcvBufSize
virtual uint32_t GetRcvBufSize(void) const
Get the receive buffer size.
Definition: nsc-tcp-socket-impl.cc:747
visualizer.ipython_view.window
window
GTK Window.
Definition: ipython_view.py:660
ns3::NscTcpSocketImpl::Bind
virtual int Bind(void)
Allocate a local IPv4 endpoint for this socket.
Definition: nsc-tcp-socket-impl.cc:222
NS_ASSERT_MSG
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition: assert.h:88
ns3::NscTcpSocketImpl::SetDelAckTimeout
virtual void SetDelAckTimeout(Time timeout)
Set the time to delay an ACK.
Definition: nsc-tcp-socket-impl.cc:825
ns3::NscTcpSocketImpl::Copy
Ptr< NscTcpSocketImpl > Copy()
Copy self.
Definition: nsc-tcp-socket-impl.cc:723
ns3::NscTcpSocketImpl::GetDelAckTimeout
virtual Time GetDelAckTimeout(void) const
Get the time to delay an ACK.
Definition: nsc-tcp-socket-impl.cc:845
ns3::NscTcpSocketImpl::GetSegSize
virtual uint32_t GetSegSize(void) const
Get the segment size.
Definition: nsc-tcp-socket-impl.cc:759
ns3::NscTcpSocketImpl::m_remotePort
uint16_t m_remotePort
peer port
Definition: nsc-tcp-socket-impl.h:229
ns3::NscTcpSocketImpl::GetErrno
virtual enum SocketErrno GetErrno(void) const
Get last error number.
Definition: nsc-tcp-socket-impl.cc:179
ns3::MakeCallback
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Definition: callback.h:1642
NS_LOG_LOGIC
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:289
ns3::NscTcpSocketImpl::m_tcp
Ptr< NscTcpL4Protocol > m_tcp
the associated TCP L4 protocol
Definition: nsc-tcp-socket-impl.h:227
ns3::NscTcpSocketImpl::GetNativeNs3Errno
enum Socket::SocketErrno GetNativeNs3Errno(int err) const
Translate between a NSC error and a ns-3 error code.
Definition: nsc-tcp-socket-impl.cc:887
ns3::Socket::ERROR_ISCONN
@ ERROR_ISCONN
Definition: socket.h:84
ns3::NscTcpSocketImpl::m_localPort
uint16_t m_localPort
local port
Definition: nsc-tcp-socket-impl.h:232
ns3::NscTcpSocketImpl::CompleteFork
void CompleteFork(void)
Complete the Fork operations (after a connection has been accepted)
Definition: nsc-tcp-socket-impl.cc:530
NSC_EMSGSIZE
@ NSC_EMSGSIZE
Definition: sim_errno.h:53
ns3::NscTcpSocketImpl::m_shutdownRecv
bool m_shutdownRecv
Receive no longer allowed.
Definition: nsc-tcp-socket-impl.h:236
timeout
ns3::Time timeout
Definition: openflow-switch.cc:52
ns3::Socket::NotifyDataRecv
void NotifyDataRecv(void)
Notify through the callback (if set) that some data have been received.
Definition: socket.cc:305
ns3::Ipv4Address::GetAny
static Ipv4Address GetAny(void)
Definition: ipv4-address.cc:395
ns3::NscTcpSocketImpl::Connect
virtual int Connect(const Address &address)
Initiate a connection to a remote host.
Definition: nsc-tcp-socket-impl.cc:324
INetStreamSocket
Struct interface to NSC Stream (i.e., TCP) Sockets.
Definition: sim_interface.h:260
NS_LOG_DEBUG
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
ns3::NscTcpSocketImpl::SendPendingData
bool SendPendingData(void)
Send all the pending data.
Definition: nsc-tcp-socket-impl.cc:656
NSC_EADDRNOTAVAIL
@ NSC_EADDRNOTAVAIL
Definition: sim_errno.h:44
ns3::Seconds
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1289
NSC_ENOTCONN
@ NSC_ENOTCONN
Definition: sim_errno.h:55
ns3::NscTcpSocketImpl::m_endPoint
Ipv4EndPoint * m_endPoint
the IPv4 endpoint
Definition: nsc-tcp-socket-impl.h:225
ns3::NscTcpSocketImpl::Listen
virtual int Listen(void)
Listen for incoming connections.
Definition: nsc-tcp-socket-impl.cc:415
NSC_ENOTDIR
@ NSC_ENOTDIR
Definition: sim_errno.h:56
ns3::Socket::BindToNetDevice
virtual void BindToNetDevice(Ptr< NetDevice > netdevice)
Bind a socket to specific device.
Definition: socket.cc:330
ns3::NscTcpSocketImpl::GetPersistTimeout
virtual Time GetPersistTimeout(void) const
Get the timeout for persistent connection.
Definition: nsc-tcp-socket-impl.cc:881
ns3::NscTcpSocketImpl::ConnectionSucceeded
void ConnectionSucceeded()
Called when a connection is in Established state.
Definition: nsc-tcp-socket-impl.cc:567
NSC_EHOSTUNREACH
@ NSC_EHOSTUNREACH
Definition: sim_errno.h:50
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Definition: log-macros-enabled.h:244
ns3::Ipv4EndPoint::SetDestroyCallback
void SetDestroyCallback(Callback< void > callback)
Set the default destroy callback.
Definition: ipv4-end-point.cc:125
nsc-tcp-l4-protocol.h
ns3::NscTcpSocketImpl::m_shutdownSend
bool m_shutdownSend
Send no longer allowed.
Definition: nsc-tcp-socket-impl.h:235
ns3::Ipv4EndPoint::GetPeerPort
uint16_t GetPeerPort(void)
Get the peer port.
Definition: ipv4-end-point.cc:81
ns3::NscTcpSocketImpl::SetAllowBroadcast
virtual bool SetAllowBroadcast(bool allowBroadcast)
Configure whether broadcast datagram transmissions are allowed.
Definition: nsc-tcp-socket-impl.cc:922
ns3::NscTcpSocketImpl::GetSndBufSize
virtual uint32_t GetSndBufSize(void) const
Get the send buffer size.
Definition: nsc-tcp-socket-impl.cc:735
ns3::NscTcpSocketImpl::NSCWakeup
void NSCWakeup(void)
Called by NscTcpSocketImpl::ForwardUp()
Definition: nsc-tcp-socket-impl.cc:425
ns3::NscTcpSocketImpl::m_node
Ptr< Node > m_node
the associated node
Definition: nsc-tcp-socket-impl.h:226
ns3::NscTcpSocketImpl::Send
virtual int Send(Ptr< Packet > p, uint32_t flags)
Send data (or dummy data) to the remote host.
Definition: nsc-tcp-socket-impl.cc:350
ns3::Ipv4EndPoint::SetRxCallback
void SetRxCallback(Callback< void, Ptr< Packet >, Ipv4Header, uint16_t, Ptr< Ipv4Interface > > callback)
Set the reception callback.
Definition: ipv4-end-point.cc:111
NSC_ECONNRESET
@ NSC_ECONNRESET
Definition: sim_errno.h:48
ns3::NscTcpSocketImpl::m_advertisedWindowSize
uint32_t m_advertisedWindowSize
Window to advertise.
Definition: nsc-tcp-socket-impl.h:250
INetStreamSocket::read_data
virtual int read_data(void *buf, int *buflen)=0
Read some data.
ns3::NscTcpSocketImpl::GetSynRetries
virtual uint32_t GetSynRetries(void) const
Get the number of connection retries before giving up.
Definition: nsc-tcp-socket-impl.cc:819
ns3::NscTcpSocketImpl::SetInitialCwnd
virtual void SetInitialCwnd(uint32_t cwnd)
Set the initial Congestion Window.
Definition: nsc-tcp-socket-impl.cc:789
INetStreamSocket::send_data
virtual int send_data(const void *data, int datalen)=0
Send some data.
ns3::NscTcpSocketImpl::GetRxAvailable
virtual uint32_t GetRxAvailable(void) const
Return number of bytes which can be returned from one or multiple calls to Recv.
Definition: nsc-tcp-socket-impl.cc:515
ns3::NscTcpSocketImpl::m_deliveryQueue
std::queue< Ptr< Packet > > m_deliveryQueue
receive buffer
Definition: nsc-tcp-socket-impl.h:266
NSC_ETIMEDOUT
@ NSC_ETIMEDOUT
Definition: sim_errno.h:58
ns3::NscTcpSocketImpl::Accept
bool Accept(void)
Accept an incoming connection.
Definition: nsc-tcp-socket-impl.cc:585
ns3::NscTcpSocketImpl::GetDelAckMaxCount
virtual uint32_t GetDelAckMaxCount(void) const
Get the number of packet to fire an ACK before delay timeout.
Definition: nsc-tcp-socket-impl.cc:857
ns3::NscTcpSocketImpl::GetAllowBroadcast
virtual bool GetAllowBroadcast() const
Query whether broadcast datagram transmissions are allowed.
Definition: nsc-tcp-socket-impl.cc:932
ns3::Ipv4EndPoint::GetPeerAddress
Ipv4Address GetPeerAddress(void)
Get the peer address.
Definition: ipv4-end-point.cc:74
ns3::Socket::NotifySend
void NotifySend(uint32_t spaceAvailable)
Notify through the callback (if set) that some data have been sent.
Definition: socket.cc:295
ns3::NscTcpSocketImpl::Destroy
void Destroy(void)
Kill this socket by zeroing its attributes (IPv4)
Definition: nsc-tcp-socket-impl.cc:199
ns3::NscTcpSocketImpl::ShutdownSend
virtual int ShutdownSend(void)
Definition: nsc-tcp-socket-impl.cc:285
ns3::Socket::NotifyDataSent
void NotifyDataSent(uint32_t size)
Notify through the callback (if set) that some data have been sent.
Definition: socket.cc:285
ns3::NscTcpSocketImpl::SetTcp
void SetTcp(Ptr< NscTcpL4Protocol > tcp)
Set the associated TCP L4 protocol.
Definition: nsc-tcp-socket-impl.cc:171
sim_errno.h
ns3::NscTcpSocketImpl::GetNode
virtual Ptr< Node > GetNode(void) const
Return the node this socket is associated with.
Definition: nsc-tcp-socket-impl.cc:192
ns3::NscTcpSocketImpl::SetNode
void SetNode(Ptr< Node > node)
Set the associated node.
Definition: nsc-tcp-socket-impl.cc:161
ns3::Socket::ERROR_NOROUTETOHOST
@ ERROR_NOROUTETOHOST
Definition: socket.h:93
ns3::NscTcpSocketImpl::m_segmentSize
uint32_t m_segmentSize
SegmentSize.
Definition: nsc-tcp-socket-impl.h:248
ns3::Simulator::ScheduleNow
static EventId ScheduleNow(FUNC f, Ts &&... args)
Schedule an event to expire Now.
Definition: simulator.h:588
ns3::NscTcpSocketImpl::SetDataRetries
virtual void SetDataRetries(uint32_t retries)
Set the number of data transmission retries before giving up.
Definition: nsc-tcp-socket-impl.cc:831
ns3::NscTcpSocketImpl::m_peerAddress
InetSocketAddress m_peerAddress
peer IP and port
Definition: nsc-tcp-socket-impl.h:233
ns3::NscTcpSocketImpl::m_synRetries
uint32_t m_synRetries
Count of remaining connection retries.
Definition: nsc-tcp-socket-impl.h:261
ns3::NscTcpSocketImpl::m_rxWindowSize
uint32_t m_rxWindowSize
Receive window size.
Definition: nsc-tcp-socket-impl.h:249
ns3::Ipv4Address::Print
void Print(std::ostream &os) const
Print this address to the given output stream.
Definition: ipv4-address.cc:340
ns3::NscTcpSocketImpl::FinishBind
int FinishBind(void)
Finish the binding process.
Definition: nsc-tcp-socket-impl.cc:207
INetStreamSocket::getpeername
virtual int getpeername(struct sockaddr *sa, size_t *salen)
Get the peer name.
Definition: sim_interface.h:331
ns3::NscTcpSocketImpl::SetConnTimeout
virtual void SetConnTimeout(Time timeout)
Set the connection timeout.
Definition: nsc-tcp-socket-impl.cc:801
port
uint16_t port
Definition: dsdv-manet.cc:45
ns3::NscTcpSocketImpl::SetPersistTimeout
virtual void SetPersistTimeout(Time timeout)
Set the timeout for persistent connection.
Definition: nsc-tcp-socket-impl.cc:875
ns3::NscTcpSocketImpl::m_cnTimeout
Time m_cnTimeout
Timeout for connection retry.
Definition: nsc-tcp-socket-impl.h:260
ns3::NscTcpSocketImpl::GetDataRetries
virtual uint32_t GetDataRetries(void) const
Get the number of data transmission retries before giving up.
Definition: nsc-tcp-socket-impl.cc:838
ns3::Socket::NotifyNewConnectionCreated
void NotifyNewConnectionCreated(Ptr< Socket > socket, const Address &from)
Notify through the callback (if set) that a new connection has been created.
Definition: socket.cc:275
ns3::Socket::NS3_SOCK_STREAM
@ NS3_SOCK_STREAM
Definition: socket.h:105
NSC_EALREADY
@ NSC_EALREADY
Definition: sim_errno.h:46