A Discrete-Event Network Simulator
API
tcp-general-test.cc
Go to the documentation of this file.
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2015 Natale Patriciello <natale.patriciello@gmail.com>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  */
19 #define __STDC_LIMIT_MACROS
20 #include "ns3/test.h"
21 #include "ns3/node-container.h"
22 #include "ns3/tcp-socket-base.h"
23 #include "ns3/simple-net-device-helper.h"
24 #include "ns3/ipv4-address-helper.h"
25 #include "ns3/internet-stack-helper.h"
26 #include "ns3/log.h"
27 #include "ns3/queue.h"
28 #include "ns3/tcp-l4-protocol.h"
29 #include "ns3/ipv4-end-point.h"
30 #include "ns3/ipv6-end-point.h"
31 #include "ns3/tcp-header.h"
32 #include "ns3/tcp-tx-buffer.h"
33 #include "ns3/tcp-rx-buffer.h"
34 #include "ns3/rtt-estimator.h"
35 
36 #include "tcp-general-test.h"
37 
38 using namespace ns3;
39 
40 NS_LOG_COMPONENT_DEFINE ("TcpGeneralTest");
41 
42 TcpGeneralTest::TcpGeneralTest (const std::string &desc)
43  : TestCase (desc),
44  m_congControlTypeId (TcpNewReno::GetTypeId ()),
45  m_recoveryTypeId (TcpClassicRecovery::GetTypeId ()),
46  m_remoteAddr (Ipv4Address::GetAny (), 4477)
47 {
48  NS_LOG_FUNCTION (this << desc);
49 }
50 
52 {
54 }
55 
56 void
58 {
59  NS_LOG_FUNCTION (this << socket);
60  Ptr<Packet> packet;
61  Address from;
62 
63  while ((packet = socket->RecvFrom (from)))
64  {
65  if (packet->GetSize () == 0)
66  { //EOF
67  break;
68  }
69  }
70 }
71 
72 void
74  uint32_t pktCount, Time pktInterval )
75 {
76  NS_LOG_FUNCTION (this << " " << pktSize << " " << pktCount << " " <<
77  pktInterval.GetSeconds ());
78  if (pktCount > 0)
79  {
80  socket->Send (Create<Packet> (pktSize));
82  socket, pktSize, pktCount - 1, pktInterval);
83  }
84  else
85  {
86  socket->Close ();
87  }
88 }
89 
90 void
92 {
93  FinalChecks ();
94 
96  NS_LOG_INFO ("Done.");
97 }
98 
99 void
101 {
102  NS_LOG_FUNCTION (this);
103 
107  SetTransmitStart (Seconds (10));
108  SetAppPktSize (500);
109  SetAppPktCount (10);
111  SetMTU (1500);
112 }
113 
114 void
116 {
117  NS_LOG_FUNCTION (this);
118  SetInitialCwnd (SENDER, 1);
119  SetInitialSsThresh (SENDER, UINT32_MAX);
120  SetSegmentSize (SENDER, 500);
121  SetSegmentSize (RECEIVER, 500);
122 }
123 
124 void
126 {
128 
129  NS_LOG_INFO ("Create nodes.");
131  nodes.Create (2);
132 
133  InternetStackHelper internet;
134  internet.Install (nodes);
135 
137 
139 
140  SimpleNetDeviceHelper helperChannel;
141  helperChannel.SetNetDevicePointToPointMode (true);
142 
143  NetDeviceContainer net = helperChannel.Install (nodes, channel);
144 
147 
148  Ptr<SimpleNetDevice> senderDev = DynamicCast<SimpleNetDevice> (net.Get (0));
149  Ptr<SimpleNetDevice> receiverDev = DynamicCast<SimpleNetDevice> (net.Get (1));
150 
151  senderDev->SetMtu (m_mtu);
152  senderDev->GetQueue ()->TraceConnect ("Drop", "SENDER",
154  senderDev->TraceConnect ("PhyRxDrop", "sender",
156 
157  receiverDev->SetMtu (m_mtu);
158  receiverDev->GetQueue ()->TraceConnect ("Drop", "RECEIVER",
160  receiverDev->TraceConnect ("PhyRxDrop", "RECEIVER",
162 
163  senderDev->SetReceiveErrorModel (senderEM);
164  receiverDev->SetReceiveErrorModel (receiverEM);
165 
166  Ipv4AddressHelper ipv4;
167  ipv4.SetBase ("10.1.1.0", "255.255.255.0");
168  Ipv4InterfaceContainer i = ipv4.Assign (net);
169  Ipv4Address serverAddress = i.GetAddress (1);
170  //Ipv4Address clientAddress = i.GetAddress (0);
171 
172  NS_LOG_INFO ("Create sockets.");
173  //Receiver socket on n1
175 
176  m_receiverSocket->SetRecvCallback (MakeCallback (&TcpGeneralTest::ReceivePacket, this));
177  m_receiverSocket->SetAcceptCallback (
178  MakeNullCallback<bool, Ptr<Socket>, const Address &> (),
180  m_receiverSocket->SetCloseCallbacks (MakeCallback (&TcpGeneralTest::NormalCloseCb, this),
183  m_receiverSocket->SetProcessedAckCb (MakeCallback (&TcpGeneralTest::ProcessedAckCb, this));
184  m_receiverSocket->SetAfterRetransmitCb (MakeCallback (&TcpGeneralTest::AfterRetransmitCb, this));
185  m_receiverSocket->SetBeforeRetransmitCb (MakeCallback (&TcpGeneralTest::BeforeRetransmitCb, this));
187  m_receiverSocket->SetUpdateRttHistoryCb (MakeCallback (&TcpGeneralTest::UpdateRttHistoryCb, this));
188  m_receiverSocket->TraceConnectWithoutContext ("Tx",
190  m_receiverSocket->TraceConnectWithoutContext ("Rx",
192 
194  m_receiverSocket->Bind (local);
195 
197  m_senderSocket->SetCloseCallbacks (MakeCallback (&TcpGeneralTest::NormalCloseCb, this),
199  m_senderSocket->SetRcvAckCb (MakeCallback (&TcpGeneralTest::RcvAckCb, this));
200  m_senderSocket->SetProcessedAckCb (MakeCallback (&TcpGeneralTest::ProcessedAckCb, this));
201  m_senderSocket->SetAfterRetransmitCb (MakeCallback (&TcpGeneralTest::AfterRetransmitCb, this));
202  m_senderSocket->SetBeforeRetransmitCb (MakeCallback (&TcpGeneralTest::BeforeRetransmitCb, this));
203  m_senderSocket->SetDataSentCallback (MakeCallback (&TcpGeneralTest::DataSentCb, this));
204  m_senderSocket->SetUpdateRttHistoryCb (MakeCallback (&TcpGeneralTest::UpdateRttHistoryCb, this));
205  m_senderSocket->TraceConnectWithoutContext ("CongestionWindow",
207  m_senderSocket->TraceConnectWithoutContext ("CongestionWindowInflated",
209  m_senderSocket->TraceConnectWithoutContext ("SlowStartThreshold",
211  m_senderSocket->TraceConnectWithoutContext ("CongState",
213  m_senderSocket->TraceConnectWithoutContext ("Tx",
215  m_senderSocket->TraceConnectWithoutContext ("Rx",
217  m_senderSocket->TraceConnectWithoutContext ("RTT",
219  m_senderSocket->TraceConnectWithoutContext ("BytesInFlight",
221  m_senderSocket->TraceConnectWithoutContext ("RTO",
223  m_senderSocket->TraceConnectWithoutContext ("NextTxSequence",
225  m_senderSocket->TraceConnectWithoutContext ("HighestSequence",
227  m_senderSocket->m_rateOps->TraceConnectWithoutContext ("TcpRateUpdated",
229  m_senderSocket->m_rateOps->TraceConnectWithoutContext ("TcpRateSampleUpdated",
231 
232 
233  m_remoteAddr = InetSocketAddress (serverAddress, 4477);
234 
236 
237  m_receiverSocket->Listen ();
238  m_receiverSocket->ShutdownSend ();
239 
242  Simulator::ScheduleWithContext (nodes.Get (0)->GetId (),
245 
246  NS_LOG_INFO ("Run Simulation.");
247  Simulator::Run ();
248 }
249 
250 void
252 {
253  NS_LOG_INFO (this);
254  m_senderSocket->Connect (m_remoteAddr);
255 }
256 
257 void
259 {
260  (void) from;
264 
265 }
266 
269 {
270  Ptr<SimpleChannel> ch = CreateObject <SimpleChannel> ();
271 
272  ch->SetAttribute ("Delay", TimeValue (m_propagationDelay));
273 
274  return ch;
275 }
276 
279  TypeId congControl)
280 {
281  return CreateSocket (node, socketType, congControl, m_recoveryTypeId);
282 }
283 
286  TypeId congControl, TypeId recoveryAlgorithm)
287 {
288  ObjectFactory rttFactory;
289  ObjectFactory congestionAlgorithmFactory;
290  ObjectFactory recoveryAlgorithmFactory;
291  ObjectFactory socketFactory;
292 
293  rttFactory.SetTypeId (RttMeanDeviation::GetTypeId ());
294  congestionAlgorithmFactory.SetTypeId (congControl);
295  recoveryAlgorithmFactory.SetTypeId (recoveryAlgorithm);
296  socketFactory.SetTypeId (socketType);
297 
298  Ptr<RttEstimator> rtt = rttFactory.Create<RttEstimator> ();
299  Ptr<TcpSocketMsgBase> socket = DynamicCast<TcpSocketMsgBase> (socketFactory.Create ());
300  Ptr<TcpCongestionOps> algo = congestionAlgorithmFactory.Create<TcpCongestionOps> ();
301  Ptr<TcpRecoveryOps> recovery = recoveryAlgorithmFactory.Create<TcpRecoveryOps> ();
302 
303  socket->SetNode (node);
304  socket->SetTcp (node->GetObject<TcpL4Protocol> ());
305  socket->SetRtt (rtt);
306  socket->SetCongestionControlAlgorithm (algo);
307  socket->SetRecoveryAlgorithm (recovery);
308  return socket;
309 }
310 
313 {
314  return nullptr;
315 }
316 
319 {
320  return nullptr;
321 }
322 
325 {
327 }
328 
331 {
333 }
334 
335 void
337 {
338  if (context.compare ("SENDER") == 0)
339  {
340  QueueDrop (SENDER);
341  }
342  else if (context.compare ("RECEIVER") == 0)
343  {
345  }
346  else
347  {
348  NS_FATAL_ERROR ("Packet dropped in a queue, but queue not recognized");
349  }
350 }
351 
352 void
354 {
355  NS_UNUSED (p);
356  if (context.compare ("SENDER") == 0)
357  {
358  PhyDrop (SENDER);
359  }
360  else if (context.compare ("RECEIVER") == 0)
361  {
362  PhyDrop (RECEIVER);
363  }
364  else
365  {
366  NS_FATAL_ERROR ("Packet dropped in a queue, but queue not recognized");
367  }
368 }
369 
370 void
372 {
373  if (socket->GetNode () == m_receiverSocket->GetNode ())
374  {
376  }
377  else if (socket->GetNode () == m_senderSocket->GetNode ())
378  {
380  }
381  else
382  {
383  NS_FATAL_ERROR ("Closed socket, but not recognized");
384  }
385 }
386 
387 void
389  const SequenceNumber32 & seq, uint32_t sz,
390  bool isRetransmission)
391 {
392  if (tcp->GetNode () == m_receiverSocket->GetNode ())
393  {
394  UpdatedRttHistory (seq, sz, isRetransmission, RECEIVER);
395  }
396  else if (tcp->GetNode () == m_senderSocket->GetNode ())
397  {
398  UpdatedRttHistory (seq, sz, isRetransmission, SENDER);
399  }
400  else
401  {
402  NS_FATAL_ERROR ("Closed socket, but not recognized");
403  }
404 }
405 
406 void
408  const Ptr<const TcpSocketBase> tcp)
409 {
410  if (tcp->GetNode () == m_receiverSocket->GetNode ())
411  {
412  AfterRTOExpired (tcb, RECEIVER);
413  }
414  else if (tcp->GetNode () == m_senderSocket->GetNode ())
415  {
416  AfterRTOExpired (tcb, SENDER);
417  }
418  else
419  {
420  NS_FATAL_ERROR ("Closed socket, but not recognized");
421  }
422 }
423 
424 void
426  const Ptr<const TcpSocketBase> tcp)
427 {
428  if (tcp->GetNode () == m_receiverSocket->GetNode ())
429  {
430  BeforeRTOExpired (tcb, RECEIVER);
431  }
432  else if (tcp->GetNode () == m_senderSocket->GetNode ())
433  {
434  BeforeRTOExpired (tcb, SENDER);
435  }
436  else
437  {
438  NS_FATAL_ERROR ("Closed socket, but not recognized");
439  }
440 }
441 
442 void
444 {
445  if (socket->GetNode () == m_receiverSocket->GetNode ())
446  {
447  DataSent (size, RECEIVER);
448  }
449  else if (socket->GetNode () == m_senderSocket->GetNode ())
450  {
451  DataSent (size, SENDER);
452  }
453  else
454  {
455  NS_FATAL_ERROR ("Closed socket, but not recognized");
456  }
457 }
458 
459 void
461 {
462  if (socket->GetNode () == m_receiverSocket->GetNode ())
463  {
465  }
466  else if (socket->GetNode () == m_senderSocket->GetNode ())
467  {
468  ErrorClose (SENDER);
469  }
470  else
471  {
472  NS_FATAL_ERROR ("Closed socket, but not recognized");
473  }
474 }
475 
476 void
478 {
479  NS_LOG_FUNCTION (this << p << h << who);
480 }
481 
482 void
484 {
485  NS_LOG_FUNCTION (this << p << h << who);
486 }
487 
488 void
490  const Ptr<const TcpSocketBase> tcp)
491 {
492  if (tcp->GetNode () == m_receiverSocket->GetNode ())
493  {
494  RcvAck (tcp->m_tcb, h, RECEIVER);
495  }
496  else if (tcp->GetNode () == m_senderSocket->GetNode ())
497  {
498  RcvAck (tcp->m_tcb, h, SENDER);
499  }
500  else
501  {
502  NS_FATAL_ERROR ("Received ACK but socket not recognized");
503  }
504 }
505 
506 void
508  const TcpHeader &h, const Ptr<const TcpSocketBase> tcp)
509 {
510  if (tcp->GetNode () == m_receiverSocket->GetNode ())
511  {
512  Tx (p, h, RECEIVER);
513  }
514  else if (tcp->GetNode () == m_senderSocket->GetNode ())
515  {
516  Tx (p, h, SENDER);
517  }
518  else
519  {
520  NS_FATAL_ERROR ("Received ACK but socket not recognized");
521  }
522 }
523 
524 void
526  const Ptr<const TcpSocketBase> tcp)
527 {
528  if (tcp->GetNode () == m_receiverSocket->GetNode ())
529  {
530  Rx (p, h, RECEIVER);
531  }
532  else if (tcp->GetNode () == m_senderSocket->GetNode ())
533  {
534  Rx (p, h, SENDER);
535  }
536  else
537  {
538  NS_FATAL_ERROR ("Received ACK but socket not recognized");
539  }
540 }
541 
542 void
545 {
546  if (tcp->GetNode () == m_receiverSocket->GetNode ())
547  {
548  ProcessedAck (tcp->m_tcb, h, RECEIVER);
549  }
550  else if (tcp->GetNode () == m_senderSocket->GetNode ())
551  {
552  ProcessedAck (tcp->m_tcb, h, SENDER);
553  }
554  else
555  {
556  NS_FATAL_ERROR ("Received ACK but socket not recognized");
557  }
558 }
559 
560 void
562 {
563  NS_LOG_FUNCTION (this << tcp);
564 
565  m_receiverSocket = tcp;
566 }
567 
568 uint32_t
570 {
571  if (who == SENDER)
572  {
573  return DynamicCast<TcpSocketMsgBase> (m_senderSocket)->m_retxThresh;
574  }
575  else if (who == RECEIVER)
576  {
577  return DynamicCast<TcpSocketMsgBase> (m_receiverSocket)->m_retxThresh;
578  }
579  else
580  {
581  NS_FATAL_ERROR ("Not defined");
582  }
583 }
584 
585 uint32_t
587 {
588  if (who == SENDER)
589  {
590  return DynamicCast<TcpSocketMsgBase> (m_senderSocket)->m_dupAckCount;
591  }
592  else if (who == RECEIVER)
593  {
594  return DynamicCast<TcpSocketMsgBase> (m_receiverSocket)->m_dupAckCount;
595  }
596  else
597  {
598  NS_FATAL_ERROR ("Not defined");
599  }
600 }
601 
602 uint32_t
604 {
605  if (who == SENDER)
606  {
607  return DynamicCast<TcpSocketMsgBase> (m_senderSocket)->m_delAckMaxCount;
608  }
609  else if (who == RECEIVER)
610  {
611  return DynamicCast<TcpSocketMsgBase> (m_receiverSocket)->m_delAckMaxCount;
612  }
613  else
614  {
615  NS_FATAL_ERROR ("Not defined");
616  }
617 }
618 
619 Time
621 {
622  if (who == SENDER)
623  {
624  return DynamicCast<TcpSocketMsgBase> (m_senderSocket)->GetDelAckTimeout ();
625  }
626  else if (who == RECEIVER)
627  {
628  return DynamicCast<TcpSocketMsgBase> (m_receiverSocket)->GetDelAckTimeout ();
629  }
630  else
631  {
632  NS_FATAL_ERROR ("Not defined");
633  }
634 }
635 
636 uint32_t
638 {
639  if (who == SENDER)
640  {
641  return DynamicCast<TcpSocketMsgBase> (m_senderSocket)->GetSegSize ();
642  }
643  else if (who == RECEIVER)
644  {
645  return DynamicCast<TcpSocketMsgBase> (m_receiverSocket)->GetSegSize ();
646  }
647  else
648  {
649  NS_FATAL_ERROR ("Not defined");
650  }
651 }
652 
655 {
656  return GetTcb (who)->m_highTxMark;
657 }
658 
659 uint32_t
661 {
662  if (who == SENDER)
663  {
664  return DynamicCast<TcpSocketMsgBase> (m_senderSocket)->GetInitialCwnd ();
665  }
666  else if (who == RECEIVER)
667  {
668  return DynamicCast<TcpSocketMsgBase> (m_receiverSocket)->GetInitialCwnd ();
669  }
670  else
671  {
672  NS_FATAL_ERROR ("Not defined");
673  }
674 }
675 
676 uint32_t
678 {
679  if (who == SENDER)
680  {
681  return DynamicCast<TcpSocketMsgBase> (m_senderSocket)->GetInitialSSThresh ();
682  }
683  else if (who == RECEIVER)
684  {
685  return DynamicCast<TcpSocketMsgBase> (m_receiverSocket)->GetInitialSSThresh ();
686  }
687  else
688  {
689  NS_FATAL_ERROR ("Not defined");
690  }
691 }
692 
693 Time
695 {
696  if (who == SENDER)
697  {
698  return DynamicCast<TcpSocketMsgBase> (m_senderSocket)->m_rto.Get ();
699  }
700  else if (who == RECEIVER)
701  {
702  return DynamicCast<TcpSocketMsgBase> (m_receiverSocket)->m_rto.Get ();
703  }
704  else
705  {
706  NS_FATAL_ERROR ("Not defined");
707  }
708 }
709 
710 Time
712 {
713  if (who == SENDER)
714  {
715  return DynamicCast<TcpSocketMsgBase> (m_senderSocket)->m_minRto;
716  }
717  else if (who == RECEIVER)
718  {
719  return DynamicCast<TcpSocketMsgBase> (m_receiverSocket)->m_minRto;
720  }
721  else
722  {
723  NS_FATAL_ERROR ("Not defined");
724  }
725 }
726 
727 Time
729 {
730  if (who == SENDER)
731  {
732  return DynamicCast<TcpSocketMsgBase> (m_senderSocket)->m_cnTimeout;
733  }
734  else if (who == RECEIVER)
735  {
736  return DynamicCast<TcpSocketMsgBase> (m_receiverSocket)->m_cnTimeout;
737  }
738  else
739  {
740  NS_FATAL_ERROR ("Not defined");
741  }
742 }
743 
746 {
747  if (who == SENDER)
748  {
749  return DynamicCast<TcpSocketMsgBase> (m_senderSocket)->m_rtt;
750  }
751  else if (who == RECEIVER)
752  {
753  return DynamicCast<TcpSocketMsgBase> (m_receiverSocket)->m_rtt;
754  }
755  else
756  {
757  NS_FATAL_ERROR ("Not defined");
758  }
759 }
760 
761 Time
763 {
764  if (who == SENDER)
765  {
766  return DynamicCast<TcpSocketMsgBase> (m_senderSocket)->m_clockGranularity;
767  }
768  else if (who == RECEIVER)
769  {
770  return DynamicCast<TcpSocketMsgBase> (m_receiverSocket)->m_clockGranularity;
771  }
772  else
773  {
774  NS_FATAL_ERROR ("Not defined");
775  }
776 }
777 
780 {
781  if (who == SENDER)
782  {
783  return DynamicCast<TcpSocketMsgBase> (m_senderSocket)->m_state.Get ();
784  }
785  else if (who == RECEIVER)
786  {
787 
788  return DynamicCast<TcpSocketMsgBase> (m_receiverSocket)->m_state.Get ();
789  }
790  else
791  {
792  NS_FATAL_ERROR ("Not defined");
793  }
794 }
795 
796 uint32_t
798 {
799  if (who == SENDER)
800  {
801  return DynamicCast<TcpSocketMsgBase> (m_senderSocket)->m_rWnd.Get ();
802  }
803  else if (who == RECEIVER)
804  {
805 
806  return DynamicCast<TcpSocketMsgBase> (m_receiverSocket)->m_rWnd.Get ();
807  }
808  else
809  {
810  NS_FATAL_ERROR ("Not defined");
811  }
812 }
813 
814 EventId
816 {
817  if (who == SENDER)
818  {
819  return DynamicCast<TcpSocketMsgBase> (m_senderSocket)->m_persistEvent;
820  }
821  else if (who == RECEIVER)
822  {
823 
824  return DynamicCast<TcpSocketMsgBase> (m_receiverSocket)->m_persistEvent;
825  }
826  else
827  {
828  NS_FATAL_ERROR ("Not defined");
829  }
830 }
831 
832 Time
834 {
835  if (who == SENDER)
836  {
837  return DynamicCast<TcpSocketMsgBase> (m_senderSocket)->m_persistTimeout;
838  }
839  else if (who == RECEIVER)
840  {
841 
842  return DynamicCast<TcpSocketMsgBase> (m_receiverSocket)->m_persistTimeout;
843  }
844  else
845  {
846  NS_FATAL_ERROR ("Not defined");
847  }
848 }
849 
852 {
853  if (who == SENDER)
854  {
855  return DynamicCast<TcpSocketMsgBase> (m_senderSocket)->m_tcb;
856  }
857  else if (who == RECEIVER)
858  {
859 
860  return DynamicCast<TcpSocketMsgBase> (m_receiverSocket)->m_tcb;
861  }
862  else
863  {
864  NS_FATAL_ERROR ("Not defined");
865  }
866 }
867 
870 {
871  if (who == SENDER)
872  {
873  return DynamicCast<TcpSocketMsgBase> (m_senderSocket)->m_tcb->m_rxBuffer;
874  }
875  else if (who == RECEIVER)
876  {
877 
878  return DynamicCast<TcpSocketMsgBase> (m_receiverSocket)->m_tcb->m_rxBuffer;
879  }
880  else
881  {
882  NS_FATAL_ERROR ("Not defined");
883  }
884 }
885 
888  {
889  if (who == SENDER)
890  {
891  return DynamicCast<TcpSocketMsgBase> (m_senderSocket)->m_txBuffer;
892  }
893  else if (who == RECEIVER)
894  {
895  return DynamicCast<TcpSocketMsgBase> (m_receiverSocket)->m_txBuffer;
896  }
897  else
898  {
899  NS_FATAL_ERROR ("Not defined");
900  }
901  }
902 
903 
904 void
906 {
907  if (who == SENDER)
908  {
909  m_senderSocket->SetRcvBufSize (size);
910  }
911  else if (who == RECEIVER)
912  {
913  m_receiverSocket->SetRcvBufSize (size);
914  }
915  else
916  {
917  NS_FATAL_ERROR ("Not defined");
918  }
919 }
920 
921 void
923 {
924  if (who == SENDER)
925  {
926  m_senderSocket->SetSegSize (segmentSize);
927  }
928  else if (who == RECEIVER)
929  {
930  m_receiverSocket->SetSegSize (segmentSize);
931  }
932  else
933  {
934  NS_FATAL_ERROR ("Not defined");
935  }
936 }
937 
938 void
939 TcpGeneralTest::SetInitialCwnd (SocketWho who, uint32_t initialCwnd)
940 {
941  if (who == SENDER)
942  {
943  m_senderSocket->SetInitialCwnd (initialCwnd);
944  }
945  else if (who == RECEIVER)
946  {
947  m_receiverSocket->SetInitialCwnd (initialCwnd);
948  }
949  else
950  {
951  NS_FATAL_ERROR ("Not defined");
952  }
953 }
954 void
956 {
957  if (who == SENDER)
958  {
959  m_senderSocket->SetDelAckMaxCount (count);
960  }
961  else if (who == RECEIVER)
962  {
963  m_receiverSocket->SetDelAckMaxCount (count);
964  }
965  else
966  {
967  NS_FATAL_ERROR ("Not defined");
968  }
969 }
970 void
972 {
973  if (who == SENDER)
974  {
975  m_senderSocket->SetUseEcn (useEcn);
976  }
977  else if (who == RECEIVER)
978  {
979  m_receiverSocket->SetUseEcn (useEcn);
980  }
981  else
982  {
983  NS_FATAL_ERROR ("Not defined");
984  }
985 }
986 
987 void
989 {
990  if (who == SENDER)
991  {
992  m_senderSocket->SetPacingStatus (pacing);
993  }
994  else if (who == RECEIVER)
995  {
996  m_receiverSocket->SetPacingStatus (pacing);
997  }
998  else
999  {
1000  NS_FATAL_ERROR ("Not defined");
1001  }
1002 }
1003 
1004 void
1006 {
1007  if (who == SENDER)
1008  {
1009  m_senderSocket->SetPaceInitialWindow (paceWindow);
1010  }
1011  else if (who == RECEIVER)
1012  {
1013  m_receiverSocket->SetPaceInitialWindow (paceWindow);
1014  }
1015  else
1016  {
1017  NS_FATAL_ERROR ("Not defined");
1018  }
1019 }
1020 
1021 void
1022 TcpGeneralTest::SetInitialSsThresh (SocketWho who, uint32_t initialSsThresh)
1023 {
1024  if (who == SENDER)
1025  {
1026  m_senderSocket->SetInitialSSThresh (initialSsThresh);
1027  }
1028  else if (who == RECEIVER)
1029  {
1030  m_receiverSocket->SetInitialSSThresh (initialSsThresh);
1031  }
1032  else
1033  {
1034  NS_FATAL_ERROR ("Not defined");
1035  }
1036 }
1037 
1039 
1040 TypeId
1042 {
1043  static TypeId tid = TypeId ("ns3::TcpSocketMsgBase")
1045  .SetGroupName ("Internet")
1046  .AddConstructor<TcpSocketMsgBase> ()
1047  ;
1048  return tid;
1049 }
1050 
1053 {
1054  return CopyObject<TcpSocketMsgBase> (this);
1055 }
1056 
1057 void
1059 {
1060  NS_ASSERT (!cb.IsNull ());
1061  m_rcvAckCb = cb;
1062 }
1063 
1064 void
1066 {
1067  NS_ASSERT (!cb.IsNull ());
1068  m_processedAckCb = cb;
1069 }
1070 
1071 void
1073 {
1074  NS_ASSERT (!cb.IsNull ());
1075  m_afterRetrCallback = cb;
1076 }
1077 
1078 void
1080 {
1081  NS_ASSERT (!cb.IsNull ());
1082  m_beforeRetrCallback = cb;
1083 }
1084 
1085 void
1087 {
1089  m_rcvAckCb (packet, tcpHeader, this);
1090 
1091  TcpSocketBase::ReceivedAck (packet, tcpHeader);
1092 
1093  m_processedAckCb (packet, tcpHeader, this);
1094 }
1095 
1096 void
1098 {
1099  m_beforeRetrCallback (m_tcb, this);
1101  m_afterRetrCallback (m_tcb, this);
1102 }
1103 
1104 void
1106 {
1107  NS_ASSERT (!cb.IsNull ());
1108  m_forkCb = cb;
1109 }
1110 
1111 void
1113 {
1114  NS_ASSERT (!cb.IsNull ());
1115  m_updateRttCb = cb;
1116 }
1117 
1118 void
1120  bool isRetransmission)
1121 {
1122  TcpSocketBase::UpdateRttHistory (seq, sz, isRetransmission);
1123  if (!m_updateRttCb.IsNull ())
1124  {
1125  m_updateRttCb (this, seq, sz, isRetransmission);
1126  }
1127 }
1128 
1129 void
1131  const Address &fromAddress, const Address &toAddress)
1132 {
1133  TcpSocketBase::CompleteFork (p, tcpHeader, fromAddress, toAddress);
1134 
1135  if (!m_forkCb.IsNull ())
1136  {
1137  m_forkCb (this);
1138  }
1139 }
1140 
1142 
1143 TypeId
1145 {
1146  static TypeId tid = TypeId ("ns3::TcpSocketSmallAcks")
1148  .SetGroupName ("Internet")
1149  .AddConstructor<TcpSocketSmallAcks> ()
1150  ;
1151  return tid;
1152 }
1153 
1154 /*
1155  * Send empty packet, copied/pasted from TcpSocketBase
1156  *
1157  * The rationale for copying/pasting is that we need to edit a little the
1158  * code inside. Since there isn't a well-defined division of duties,
1159  * we are forced to do this.
1160  */
1161 void
1163 {
1164  Ptr<Packet> p = Create<Packet> ();
1165  TcpHeader header;
1167 
1168  /*
1169  * Add tags for each socket option.
1170  * Note that currently the socket adds both IPv4 tag and IPv6 tag
1171  * if both options are set. Once the packet got to layer three, only
1172  * the corresponding tags will be read.
1173  */
1174  if (GetIpTos ())
1175  {
1176  SocketIpTosTag ipTosTag;
1177  ipTosTag.SetTos (GetIpTos ());
1178  p->AddPacketTag (ipTosTag);
1179  }
1180 
1181  if (IsManualIpv6Tclass ())
1182  {
1183  SocketIpv6TclassTag ipTclassTag;
1184  ipTclassTag.SetTclass (GetIpv6Tclass ());
1185  p->AddPacketTag (ipTclassTag);
1186  }
1187 
1188  if (IsManualIpTtl ())
1189  {
1190  SocketIpTtlTag ipTtlTag;
1191  ipTtlTag.SetTtl (GetIpTtl ());
1192  p->AddPacketTag (ipTtlTag);
1193  }
1194 
1195  if (IsManualIpv6HopLimit ())
1196  {
1197  SocketIpv6HopLimitTag ipHopLimitTag;
1198  ipHopLimitTag.SetHopLimit (GetIpv6HopLimit ());
1199  p->AddPacketTag (ipHopLimitTag);
1200  }
1201 
1202  if (m_endPoint == nullptr && m_endPoint6 == nullptr)
1203  {
1204  NS_LOG_WARN ("Failed to send empty packet due to null endpoint");
1205  return;
1206  }
1207  if (flags & TcpHeader::FIN)
1208  {
1209  flags |= TcpHeader::ACK;
1210  }
1211  else if (m_state == FIN_WAIT_1 || m_state == LAST_ACK || m_state == CLOSING)
1212  {
1213  ++s;
1214  }
1215 
1216  bool hasSyn = flags & TcpHeader::SYN;
1217  bool hasFin = flags & TcpHeader::FIN;
1218  bool isAck = flags == TcpHeader::ACK;
1219 
1220  header.SetFlags (flags);
1221  header.SetSequenceNumber (s);
1222 
1223  // Actual division in small acks.
1224  if (hasSyn || hasFin)
1225  {
1226  header.SetAckNumber (m_tcb->m_rxBuffer->NextRxSequence ());
1227  }
1228  else
1229  {
1230  SequenceNumber32 ackSeq;
1231 
1232  ackSeq = m_lastAckedSeq + m_bytesToAck;
1233 
1234  if (m_bytesLeftToBeAcked == 0 && m_tcb->m_rxBuffer->NextRxSequence () > m_lastAckedSeq)
1235  {
1236  m_bytesLeftToBeAcked = m_tcb->m_rxBuffer->NextRxSequence ().GetValue () - m_lastAckedSeq.GetValue ();
1238  NS_LOG_DEBUG ("Setting m_bytesLeftToBeAcked to " << m_bytesLeftToBeAcked);
1239  }
1240  else if (m_bytesLeftToBeAcked > 0 && m_tcb->m_rxBuffer->NextRxSequence () > m_lastAckedSeq)
1241  {
1243  NS_LOG_DEBUG ("Decrementing m_bytesLeftToBeAcked to " << m_bytesLeftToBeAcked);
1244  }
1245 
1246  NS_LOG_LOGIC ("Acking up to " << ackSeq << " remaining bytes: " << m_bytesLeftToBeAcked);
1247 
1248  header.SetAckNumber (ackSeq);
1249  m_lastAckedSeq = ackSeq;
1250  }
1251 
1252  // end of division in small acks
1253 
1254  if (m_endPoint != nullptr)
1255  {
1256  header.SetSourcePort (m_endPoint->GetLocalPort ());
1258  }
1259  else
1260  {
1261  header.SetSourcePort (m_endPoint6->GetLocalPort ());
1263  }
1264  AddOptions (header);
1265  header.SetWindowSize (AdvertisedWindowSize ());
1266 
1267  // RFC 6298, clause 2.4
1268  m_rto = Max (m_rtt->GetEstimate () + Max (m_clockGranularity, m_rtt->GetVariation () * 4), m_minRto);
1269 
1270  if (hasSyn)
1271  {
1272  if (m_synCount == 0)
1273  { // No more connection retries, give up
1274  NS_LOG_LOGIC ("Connection failed.");
1275  m_rtt->Reset (); //According to recommendation -> RFC 6298
1276  CloseAndNotify ();
1277  return;
1278  }
1279  else
1280  { // Exponential backoff of connection time out
1281  int backoffCount = 0x1 << (m_synRetries - m_synCount);
1282  m_rto = m_cnTimeout * backoffCount;
1283  m_synCount--;
1284  }
1285  }
1286  if (m_endPoint != nullptr)
1287  {
1288  m_tcp->SendPacket (p, header, m_endPoint->GetLocalAddress (),
1290  }
1291  else
1292  {
1293  m_tcp->SendPacket (p, header, m_endPoint6->GetLocalAddress (),
1295  }
1296 
1297  m_txTrace (p, header, this);
1298 
1299  if (flags & TcpHeader::ACK)
1300  { // If sending an ACK, cancel the delay ACK as well
1301  m_delAckEvent.Cancel ();
1302  m_delAckCount = 0;
1303  }
1304  if (m_retxEvent.IsExpired () && (hasSyn || hasFin) && !isAck )
1305  { // Retransmit SYN / SYN+ACK / FIN / FIN+ACK to guard against lost
1306  NS_LOG_LOGIC ("Schedule retransmission timeout at time "
1307  << Simulator::Now ().GetSeconds () << " to expire at time "
1308  << (Simulator::Now () + m_rto.Get ()).GetSeconds ());
1310  }
1311 
1312  // send another ACK if bytes remain
1313  if (m_bytesLeftToBeAcked > m_bytesToAck && m_tcb->m_rxBuffer->NextRxSequence () > m_lastAckedSeq && !hasFin)
1314  {
1315  NS_LOG_DEBUG ("Recursing to call SendEmptyPacket() again with m_bytesLeftToBeAcked = " << m_bytesLeftToBeAcked);
1316  SendEmptyPacket (flags);
1317  }
1318 }
1319 
1322 {
1323  return CopyObject<TcpSocketSmallAcks> (this);
1324 }
1325 
ns3::NetDeviceContainer
holds a vector of ns3::NetDevice pointers
Definition: net-device-container.h:42
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::TcpGeneralTest::TxPacketCb
void TxPacketCb(const Ptr< const Packet > p, const TcpHeader &h, const Ptr< const TcpSocketBase > tcp)
Tx packet Callback.
Definition: tcp-general-test.cc:507
ns3::InetSocketAddress
an Inet address class
Definition: inet-socket-address.h:41
ns3::TcpSocketMsgBase::SetProcessedAckCb
void SetProcessedAckCb(AckManagementCb cb)
Set the callback invoked when an ACK is received and processed (at the end of the processing)
Definition: tcp-general-test.cc:1065
ns3::TcpSocketBase::AdvertisedWindowSize
virtual uint16_t AdvertisedWindowSize(bool scale=true) const
The amount of Rx window announced to the peer.
Definition: tcp-socket-base.cc:3394
ns3::TcpGeneralTest::SocketWho
SocketWho
Used as parameter of methods, specifies on what node the caller is interested (e.g.
Definition: tcp-general-test.h:275
ns3::TcpGeneralTest::m_startTime
Time m_startTime
Data transmission time.
Definition: tcp-general-test.h:1044
ns3::TcpHeader::SetSourcePort
void SetSourcePort(uint16_t port)
Set the source port.
Definition: tcp-header.cc:89
ns3::TracedValue::Get
T Get(void) const
Get the underlying value.
Definition: traced-value.h:229
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
ns3::TcpGeneralTest::BytesInFlightTrace
virtual void BytesInFlightTrace(uint32_t oldValue, uint32_t newValue)
Bytes in flight changes.
Definition: tcp-general-test.h:766
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::TcpGeneralTest::NextTxSeqTrace
virtual void NextTxSeqTrace(SequenceNumber32 oldValue, SequenceNumber32 newValue)
Next tx seq changes.
Definition: tcp-general-test.h:794
ns3::TcpGeneralTest::Rx
virtual void Rx(const Ptr< const Packet > p, const TcpHeader &h, SocketWho who)
Packet received from IP layer.
Definition: tcp-general-test.cc:483
ns3::TcpGeneralTest::FinalChecks
virtual void FinalChecks()
Performs the (eventual) final checks through test asserts.
Definition: tcp-general-test.h:977
ns3::Simulator::ScheduleWithContext
static void ScheduleWithContext(uint32_t context, Time const &delay, FUNC f, Ts &&... args)
Schedule an event with the given context.
Definition: simulator.h:572
ns3::TcpGeneralTest::NormalCloseCb
void NormalCloseCb(Ptr< Socket > socket)
Normal Close Callback.
Definition: tcp-general-test.cc:371
ns3::TcpGeneralTest::RxPacketCb
void RxPacketCb(const Ptr< const Packet > p, const TcpHeader &h, const Ptr< const TcpSocketBase > tcp)
Rx packet Callback.
Definition: tcp-general-test.cc:525
ns3::EventId
An identifier for simulation events.
Definition: event-id.h:54
ns3::TcpGeneralTest::RcvAck
virtual void RcvAck(const Ptr< const TcpSocketState > tcb, const TcpHeader &h, SocketWho who)
Received ack.
Definition: tcp-general-test.h:879
ns3::TcpHeader::SetSequenceNumber
void SetSequenceNumber(SequenceNumber32 sequenceNumber)
Set the sequence Number.
Definition: tcp-header.cc:101
ns3::TcpSocket::LAST_ACK
@ LAST_ACK
Our side has shutdown after remote has shutdown.
Definition: tcp-socket.h:75
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::Callback< void, Ptr< const Packet >, const TcpHeader &, Ptr< const TcpSocketBase > >
ns3::Socket::SetCloseCallbacks
void SetCloseCallbacks(Callback< void, Ptr< Socket > > normalClose, Callback< void, Ptr< Socket > > errorClose)
Detect socket recv() events such as graceful shutdown or error.
Definition: socket.cc:94
ns3::TcpGeneralTest::DataSent
virtual void DataSent(uint32_t size, SocketWho who)
Notifying application for sent data.
Definition: tcp-general-test.h:968
ns3::Simulator::Now
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:195
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::TcpGeneralTest::CreateChannel
virtual Ptr< SimpleChannel > CreateChannel()
Create and return the channel installed between the two socket.
Definition: tcp-general-test.cc:268
ns3::TcpGeneralTest::ProcessedAckCb
void ProcessedAckCb(Ptr< const Packet > p, const TcpHeader &h, Ptr< const TcpSocketBase > tcp)
ACK processed Callback.
Definition: tcp-general-test.cc:543
ns3::TcpGeneralTest::SENDER
@ SENDER
Sender node.
Definition: tcp-general-test.h:276
ns3::Ipv4AddressHelper
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
Definition: ipv4-address-helper.h:48
ns3::RttEstimator
Base class for all RTT Estimators.
Definition: rtt-estimator.h:43
ns3::TcpSocketState::m_highTxMark
TracedValue< SequenceNumber32 > m_highTxMark
Highest seqno ever sent, regardless of ReTx.
Definition: tcp-socket-state.h:184
ns3::TcpGeneralTest::~TcpGeneralTest
~TcpGeneralTest()
Definition: tcp-general-test.cc:51
ns3::Callback::IsNull
bool IsNull(void) const
Check for null implementation.
Definition: callback.h:1386
ns3::TcpGeneralTest::SetTransmitStart
void SetTransmitStart(Time startTime)
Set the initial time at which the application sends the first data packet.
Definition: tcp-general-test.h:671
ns3::TcpGeneralTest::SetCongestionControl
void SetCongestionControl(TypeId congControl)
Congestion control of the sender socket.
Definition: tcp-general-test.h:678
ns3::TcpGeneralTest::m_pktCount
uint32_t m_pktCount
Count of the application packet.
Definition: tcp-general-test.h:1048
ns3::TcpSocketState::m_nextTxSequence
TracedValue< SequenceNumber32 > m_nextTxSequence
Next seqnum to be sent (SND.NXT), ReTx pushes it back.
Definition: tcp-socket-state.h:185
ns3::TcpGeneralTest::TcpGeneralTest
TcpGeneralTest(const std::string &desc)
TcpGeneralTest constructor.
Definition: tcp-general-test.cc:42
ns3::TcpGeneralTest::GetTcpState
TcpSocket::TcpStates_t GetTcpState(SocketWho who)
Get the state of the TCP state machine.
Definition: tcp-general-test.cc:779
ns3::TcpGeneralTest::ConfigureProperties
virtual void ConfigureProperties(void)
Change the configuration of the socket properties.
Definition: tcp-general-test.cc:115
ns3::TcpGeneralTest::SetAppPktCount
void SetAppPktCount(uint32_t pktCount)
Set app packet count.
Definition: tcp-general-test.h:650
ns3::Socket::GetNode
virtual Ptr< Node > GetNode(void) const =0
Return the node this socket is associated with.
ns3::TcpGeneralTest::CWndTrace
virtual void CWndTrace(uint32_t oldValue, uint32_t newValue)
Tracks the congestion window changes.
Definition: tcp-general-test.h:712
ns3::Object::GetObject
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Definition: object.h:470
ns3::Packet::EnablePrinting
static void EnablePrinting(void)
Enable printing packets metadata.
Definition: packet.cc:572
ns3::TcpGeneralTest::GetConnTimeout
Time GetConnTimeout(SocketWho who)
Get the retransmission time for the SYN segments.
Definition: tcp-general-test.cc:728
ns3::TcpGeneralTest::SetPaceInitialWindow
void SetPaceInitialWindow(SocketWho who, bool paceWindow)
Enable or disable pacing of the initial window.
Definition: tcp-general-test.cc:1005
ns3::Ipv6EndPoint::GetLocalAddress
Ipv6Address GetLocalAddress()
Get the local address.
Definition: ipv6-end-point.cc:52
third.channel
channel
Definition: third.py:92
ns3::TcpSocketMsgBase
Class for inserting callbacks special points of the flow of TCP sockets.
Definition: tcp-general-test.h:53
ns3::TcpSocketMsgBase::m_beforeRetrCallback
RetrCb m_beforeRetrCallback
Before retransmission callback.
Definition: tcp-general-test.h:144
ns3::TcpGeneralTest::CreateSocket
virtual Ptr< TcpSocketMsgBase > CreateSocket(Ptr< Node > node, TypeId socketType, TypeId congControl)
Create a socket.
Definition: tcp-general-test.cc:278
ns3::TcpGeneralTest::SetInitialCwnd
void SetInitialCwnd(SocketWho who, uint32_t initialCwnd)
Forcefully set the initial cwnd.
Definition: tcp-general-test.cc:939
ns3::TcpGeneralTest::ForkCb
void ForkCb(Ptr< TcpSocketMsgBase > tcp)
Fork Callback.
Definition: tcp-general-test.cc:561
NS_LOG_WARN
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Definition: log.h:265
ns3::TcpSocketSmallAcks::m_bytesToAck
uint32_t m_bytesToAck
Number of bytes to be ACKed.
Definition: tcp-general-test.h:210
ns3::TcpGeneralTest::GetRWnd
uint32_t GetRWnd(SocketWho who)
Get the rWnd of the selected socket.
Definition: tcp-general-test.cc:797
ns3::TcpSocket::FIN_WAIT_1
@ FIN_WAIT_1
Our side has shutdown, waiting to complete transmission of remaining buffered data
Definition: tcp-socket.h:78
ns3::TcpGeneralTest::Tx
virtual void Tx(const Ptr< const Packet > p, const TcpHeader &h, SocketWho who)
Packet transmitted down to IP layer.
Definition: tcp-general-test.cc:477
ns3::TcpGeneralTest::HandleAccept
void HandleAccept(Ptr< Socket > socket, const Address &from)
Handle an accept connection.
Definition: tcp-general-test.cc:258
ns3::TcpSocketMsgBase::Fork
virtual Ptr< TcpSocketBase > Fork(void)
Call CopyObject<> to clone me.
Definition: tcp-general-test.cc:1052
ns3::Ipv4Address
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:41
ns3::TcpSocketBase::AddOptions
void AddOptions(TcpHeader &tcpHeader)
Add options to TcpHeader.
Definition: tcp-socket-base.cc:4085
ns3::TcpGeneralTest::SetRcvBufSize
void SetRcvBufSize(SocketWho who, uint32_t size)
Forcefully set a defined size for rx buffer.
Definition: tcp-general-test.cc:905
ns3::TcpSocketBase::m_retxEvent
EventId m_retxEvent
Retransmission event.
Definition: tcp-socket-base.h:1246
ns3::TcpGeneralTest::m_pktSize
uint32_t m_pktSize
Size of the application packet.
Definition: tcp-general-test.h:1047
ns3::ObjectBase::SetAttribute
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:185
ns3::TcpSocketMsgBase::m_rcvAckCb
AckManagementCb m_rcvAckCb
Receive ACK callback.
Definition: tcp-general-test.h:142
ns3::SocketIpTtlTag::SetTtl
void SetTtl(uint8_t ttl)
Set the tag's TTL.
Definition: socket.cc:604
ns3::TcpSocketBase::ReTxTimeout
virtual void ReTxTimeout(void)
An RTO event happened.
Definition: tcp-socket-base.cc:3626
ns3::SimpleNetDevice::SetMtu
virtual bool SetMtu(const uint16_t mtu)
Definition: simple-net-device.cc:338
ns3::TcpGeneralTest::m_recoveryTypeId
TypeId m_recoveryTypeId
Recovery.
Definition: tcp-general-test.h:1037
ns3::TcpSocketBase::m_endPoint
Ipv4EndPoint * m_endPoint
the IPv4 endpoint
Definition: tcp-socket-base.h:1278
ns3::TcpSocketBase
A base class for implementation of a stream socket using TCP.
Definition: tcp-socket-base.h:218
ns3::TcpHeader::SetAckNumber
void SetAckNumber(SequenceNumber32 ackNumber)
Set the ACK number.
Definition: tcp-header.cc:107
ns3::Simulator::Schedule
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:557
ns3::TcpSocketBase::m_tcb
Ptr< TcpSocketState > m_tcb
Congestion control information.
Definition: tcp-socket-base.h:1328
ns3::TcpGeneralTest::RateSampleUpdatedTrace
virtual void RateSampleUpdatedTrace(const TcpRateLinux::TcpRateSample &sample)
Track the rate sample value of TcpRateLinux.
Definition: tcp-general-test.h:827
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:923
ns3::TcpGeneralTest::GetSegSize
uint32_t GetSegSize(SocketWho who)
Get the segment size of the node specified.
Definition: tcp-general-test.cc:637
ns3::Socket::GetIpTtl
virtual uint8_t GetIpTtl(void) const
Query the value of IP Time to Live field of this socket.
Definition: socket.cc:520
ns3::TcpGeneralTest::SetMTU
void SetMTU(uint32_t mtu)
MTU of the bottleneck link.
Definition: tcp-general-test.h:692
ns3::TcpGeneralTest::m_receiverSocket
Ptr< TcpSocketMsgBase > m_receiverSocket
Pointer to receiver socket.
Definition: tcp-general-test.h:1052
ns3::TcpSocketMsgBase::ReTxTimeout
virtual void ReTxTimeout(void)
An RTO event happened.
Definition: tcp-general-test.cc:1097
ns3::MakeNullCallback
Callback< R, Ts... > MakeNullCallback(void)
Definition: callback.h:1682
first.nodes
nodes
Definition: first.py:32
ns3::TcpGeneralTest::m_remoteAddr
InetSocketAddress m_remoteAddr
Remote peer address.
Definition: tcp-general-test.h:1162
ns3::TestCase
encapsulates test code
Definition: test.h:1154
ns3::TcpGeneralTest::HighestTxSeqTrace
virtual void HighestTxSeqTrace(SequenceNumber32 oldValue, SequenceNumber32 newValue)
Highest tx seq changes.
Definition: tcp-general-test.h:808
ns3::TcpHeader::SetFlags
void SetFlags(uint8_t flags)
Set flags of the header.
Definition: tcp-header.cc:113
ns3::Socket::GetIpv6HopLimit
virtual uint8_t GetIpv6HopLimit(void) const
Query the value of IP Hop Limit field of this socket.
Definition: socket.cc:545
ns3::Ipv4AddressHelper::SetBase
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
Definition: ipv4-address-helper.cc:64
ns3::TcpHeader::SYN
@ SYN
SYN.
Definition: tcp-header.h:283
ns3::Ptr< Socket >
ns3::Max
int64x64_t Max(const int64x64_t &a, const int64x64_t &b)
Maximum.
Definition: int64x64.h:230
NS_FATAL_ERROR
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:165
ns3::TcpSocketBase::m_tcp
Ptr< TcpL4Protocol > m_tcp
the associated TCP L4 protocol
Definition: tcp-socket-base.h:1281
ns3::TcpSocketSmallAcks
A TCP socket which sends ACKs smaller than the segment received.
Definition: tcp-general-test.h:169
ns3::Ipv6EndPoint::GetPeerAddress
Ipv6Address GetPeerAddress()
Get the peer address.
Definition: ipv6-end-point.cc:72
ns3::Socket::Send
virtual int Send(Ptr< Packet > p, uint32_t flags)=0
Send data (or dummy data) to the remote host.
ns3::Ipv4EndPoint::GetLocalPort
uint16_t GetLocalPort(void)
Get the local port.
Definition: ipv4-end-point.cc:67
ns3::Socket::SetRecvCallback
void SetRecvCallback(Callback< void, Ptr< Socket > > receivedData)
Notify application when new data is available to be read.
Definition: socket.cc:128
ns3::TcpGeneralTest::GetInitialCwnd
uint32_t GetInitialCwnd(SocketWho who)
Get the initial congestion window.
Definition: tcp-general-test.cc:660
ns3::TcpGeneralTest::RateUpdatedTrace
virtual void RateUpdatedTrace(const TcpRateLinux::TcpRateConnection &rate)
Track the rate value of TcpRateLinux.
Definition: tcp-general-test.h:818
ns3::TcpGeneralTest::BeforeRetransmitCb
void BeforeRetransmitCb(const Ptr< const TcpSocketState > tcb, const Ptr< const TcpSocketBase > tcp)
Invoked before a retransmit event.
Definition: tcp-general-test.cc:425
ns3::TcpGeneralTest::m_senderSocket
Ptr< TcpSocketMsgBase > m_senderSocket
Pointer to sender socket.
Definition: tcp-general-test.h:1051
ns3::TcpSocketMsgBase::UpdateRttHistory
virtual void UpdateRttHistory(const SequenceNumber32 &seq, uint32_t sz, bool isRetransmission)
Update the RTT history, when we send TCP segments.
Definition: tcp-general-test.cc:1119
ns3::TcpGeneralTest::CreateSenderErrorModel
virtual Ptr< ErrorModel > CreateSenderErrorModel()
Create and return the error model to install in the sender node.
Definition: tcp-general-test.cc:312
ns3::TcpSocketMsgBase::m_afterRetrCallback
RetrCb m_afterRetrCallback
After retransmission callback.
Definition: tcp-general-test.h:145
ns3::Address
a polymophic address class
Definition: address.h:91
ns3::TcpSocketBase::m_delAckEvent
EventId m_delAckEvent
Delayed ACK timeout event.
Definition: tcp-socket-base.h:1248
ns3::TcpGeneralTest::PhyDrop
virtual void PhyDrop(SocketWho who)
Link drop.
Definition: tcp-general-test.h:865
ns3::TcpGeneralTest::m_mtu
uint32_t m_mtu
MTU of the environment.
Definition: tcp-general-test.h:1045
ns3::TcpSocketBase::GetNode
virtual Ptr< Node > GetNode(void) const
Return the node this socket is associated with.
Definition: tcp-socket-base.cc:509
ns3::TcpSocketSmallAcks::SendEmptyPacket
virtual void SendEmptyPacket(uint8_t flags)
Send a empty packet that carries a flag, e.g., ACK.
Definition: tcp-general-test.cc:1162
ns3::TcpSocketBase::m_clockGranularity
Time m_clockGranularity
Clock Granularity used in RTO calcs.
Definition: tcp-socket-base.h:1269
ns3::InternetStackHelper::Install
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
Definition: internet-stack-helper.cc:366
ns3::RttMeanDeviation::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition: rtt-estimator.cc:130
ns3::TcpGeneralTest::RtoTrace
virtual void RtoTrace(Time oldValue, Time newValue)
RTO changes.
Definition: tcp-general-test.h:780
ns3::TcpGeneralTest::SetDelAckMaxCount
void SetDelAckMaxCount(SocketWho who, uint32_t count)
Forcefully set the delayed acknowledgement count.
Definition: tcp-general-test.cc:955
NS_LOG_INFO
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:281
ns3::TcpSocketMsgBase::ReceivedAck
virtual void ReceivedAck(Ptr< Packet > packet, const TcpHeader &tcpHeader)
Received an ACK packet.
Definition: tcp-general-test.cc:1086
ns3::TcpGeneralTest::GetDelAckTimeout
Time GetDelAckTimeout(SocketWho who)
Get the timeout of delayed ack (if present)
Definition: tcp-general-test.cc:620
ns3::Socket::RecvFrom
virtual Ptr< Packet > RecvFrom(uint32_t maxSize, uint32_t flags, Address &fromAddress)=0
Read a single packet from the socket and retrieve the sender address.
ns3::MilliSeconds
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1297
ns3::TcpSocketBase::m_endPoint6
Ipv6EndPoint * m_endPoint6
the IPv6 endpoint
Definition: tcp-socket-base.h:1279
ns3::TcpSocketMsgBase::m_updateRttCb
UpdateRttCallback m_updateRttCb
Update RTT callback.
Definition: tcp-general-test.h:147
ns3::SocketIpv6HopLimitTag
This class implements a tag that carries the socket-specific HOPLIMIT of a packet to the IPv6 layer.
Definition: socket.h:1165
ns3::EventId::Cancel
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::Cancel method.
Definition: event-id.cc:53
NS_UNUSED
#define NS_UNUSED(x)
Mark a local variable as unused.
Definition: unused.h:36
ns3::ObjectFactory
Instantiate subclasses of ns3::Object.
Definition: object-factory.h:48
ns3::Ipv6EndPoint::GetLocalPort
uint16_t GetLocalPort()
Get the local port.
Definition: ipv6-end-point.cc:62
ns3::TcpSocketMsgBase::CompleteFork
virtual void CompleteFork(Ptr< Packet > p, const TcpHeader &tcpHeader, const Address &fromAddress, const Address &toAddress)
Complete a connection by forking the socket.
Definition: tcp-general-test.cc:1130
ns3::TcpSocketBase::ReceivedAck
virtual void ReceivedAck(Ptr< Packet > packet, const TcpHeader &tcpHeader)
Received an ACK packet.
Definition: tcp-socket-base.cc:1766
ns3::TcpGeneralTest::CWndInflTrace
virtual void CWndInflTrace(uint32_t oldValue, uint32_t newValue)
Tracks the inflated congestion window changes.
Definition: tcp-general-test.h:724
ns3::TcpGeneralTest::SetAppPktInterval
void SetAppPktInterval(Time pktInterval)
Interval between app-generated packet.
Definition: tcp-general-test.h:657
ns3::TcpGeneralTest::ConfigureEnvironment
virtual void ConfigureEnvironment(void)
Change the configuration of the environment.
Definition: tcp-general-test.cc:100
ns3::TcpGeneralTest::ErrorCloseCb
void ErrorCloseCb(Ptr< Socket > socket)
Error Close Callback.
Definition: tcp-general-test.cc:460
ns3::TcpGeneralTest::DoTeardown
virtual void DoTeardown(void)
Teardown the TCP test.
Definition: tcp-general-test.cc:91
ns3::TcpGeneralTest::GetMinRto
Time GetMinRto(SocketWho who)
Get the minimum RTO attribute.
Definition: tcp-general-test.cc:711
ns3::Ipv4InterfaceContainer
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Definition: ipv4-interface-container.h:55
ns3::TcpSocket::CLOSING
@ CLOSING
Both sides have shutdown but we still have data we have to finish sending
Definition: tcp-socket.h:81
ns3::Ipv6EndPoint::GetPeerPort
uint16_t GetPeerPort()
Get the peer port.
Definition: ipv6-end-point.cc:77
ns3::SimpleNetDeviceHelper
build a set of SimpleNetDevice objects
Definition: simple-net-device-helper.h:37
ns3::Ipv4EndPoint::GetLocalAddress
Ipv4Address GetLocalAddress(void)
Get the local address.
Definition: ipv4-end-point.cc:53
ns3::TcpGeneralTest::RECEIVER
@ RECEIVER
Receiver node.
Definition: tcp-general-test.h:277
ns3::TcpGeneralTest::SetPacingStatus
void SetPacingStatus(SocketWho who, bool pacing)
Enable or disable pacing in the TCP socket.
Definition: tcp-general-test.cc:988
ns3::TcpGeneralTest::ProcessedAck
virtual void ProcessedAck(const Ptr< const TcpSocketState > tcb, const TcpHeader &h, SocketWho who)
Processed ack.
Definition: tcp-general-test.h:896
ns3::TcpGeneralTest::RcvAckCb
void RcvAckCb(Ptr< const Packet > p, const TcpHeader &h, Ptr< const TcpSocketBase > tcp)
Receive ACK Callback.
Definition: tcp-general-test.cc:489
ns3::Socket::IsManualIpv6HopLimit
bool IsManualIpv6HopLimit(void) const
Checks if the socket has a specific IPv6 Hop Limit set.
Definition: socket.cc:383
ns3::SocketIpv6TclassTag
indicates whether the socket has IPV6_TCLASS set.
Definition: socket.h:1356
ns3::TcpSocketSmallAcks::Fork
Ptr< TcpSocketBase > Fork(void)
Call CopyObject<> to clone me.
Definition: tcp-general-test.cc:1321
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
ns3::Socket::Close
virtual int Close(void)=0
Close a socket.
ns3::TcpHeader
Header for the Transmission Control Protocol.
Definition: tcp-header.h:45
ns3::TcpGeneralTest::ErrorClose
virtual void ErrorClose(SocketWho who)
Socket closed with an error.
Definition: tcp-general-test.h:846
ns3::TcpGeneralTest::UpdatedRttHistory
virtual void UpdatedRttHistory(const SequenceNumber32 &seq, uint32_t sz, bool isRetransmission, SocketWho who)
Updated the Rtt history.
Definition: tcp-general-test.h:953
ns3::TcpGeneralTest::NormalClose
virtual void NormalClose(SocketWho who)
Socket closed normally.
Definition: tcp-general-test.h:836
ns3::TcpGeneralTest::GetRxBuffer
Ptr< TcpRxBuffer > GetRxBuffer(SocketWho who)
Get the Rx buffer from selected socket.
Definition: tcp-general-test.cc:869
ns3::TcpSocketBase::CompleteFork
virtual void CompleteFork(Ptr< Packet > p, const TcpHeader &tcpHeader, const Address &fromAddress, const Address &toAddress)
Complete a connection by forking the socket.
Definition: tcp-socket-base.cc:2889
ns3::TcpSocketMsgBase::SetAfterRetransmitCb
void SetAfterRetransmitCb(RetrCb cb)
Set the callback invoked after the processing of a retransmit timeout.
Definition: tcp-general-test.cc:1072
ns3::SimpleNetDeviceHelper::Install
NetDeviceContainer Install(Ptr< Node > node) const
This method creates an ns3::SimpleChannel with the attributes configured by SimpleNetDeviceHelper::Se...
Definition: simple-net-device-helper.cc:100
ns3::TcpGeneralTest::CongStateTrace
virtual void CongStateTrace(const TcpSocketState::TcpCongState_t oldValue, const TcpSocketState::TcpCongState_t newValue)
State on Ack state machine changes.
Definition: tcp-general-test.h:699
ns3::SimpleNetDevice::GetQueue
Ptr< Queue< Packet > > GetQueue(void) const
Get a copy of the attached Queue.
Definition: simple-net-device.cc:284
ns3::TcpSocketMsgBase::SetRcvAckCb
void SetRcvAckCb(AckManagementCb cb)
Set the callback invoked when an ACK is received (at the beginning of the processing)
Definition: tcp-general-test.cc:1058
ns3::TcpGeneralTest::ReceivePacket
virtual void ReceivePacket(Ptr< Socket > socket)
Packet received.
Definition: tcp-general-test.cc:57
ns3::TcpGeneralTest::PhyDropCb
void PhyDropCb(std::string context, Ptr< const Packet > p)
Drop at Phy layer Callback.
Definition: tcp-general-test.cc:353
ns3::TcpSocketMsgBase::SetBeforeRetransmitCb
void SetBeforeRetransmitCb(RetrCb cb)
Set the callback invoked before the processing of a retransmit timeout.
Definition: tcp-general-test.cc:1079
ns3::TcpSocketMsgBase::SetUpdateRttHistoryCb
void SetUpdateRttHistoryCb(UpdateRttCallback cb)
Set the callback invoked when we update rtt history.
Definition: tcp-general-test.cc:1112
ns3::TcpGeneralTest::GetTcb
Ptr< TcpSocketState > GetTcb(SocketWho who)
Get the TCB from selected socket.
Definition: tcp-general-test.cc:851
tcp-general-test.h
ns3::TcpGeneralTest::BeforeRTOExpired
virtual void BeforeRTOExpired(const Ptr< const TcpSocketState > tcb, SocketWho who)
Rto has expired.
Definition: tcp-general-test.h:940
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::Simulator::Run
static void Run(void)
Run the simulation.
Definition: simulator.cc:172
ns3::TcpSocketBase::m_state
TracedValue< TcpStates_t > m_state
TCP state.
Definition: tcp-socket-base.h:1291
ns3::TcpSocketMsgBase::m_processedAckCb
AckManagementCb m_processedAckCb
Processed ACK callback.
Definition: tcp-general-test.h:143
ns3::TcpGeneralTest::DoRun
virtual void DoRun(void)
Execute the tcp test.
Definition: tcp-general-test.cc:125
ns3::TcpSocketState::m_rxBuffer
Ptr< TcpRxBuffer > m_rxBuffer
Rx buffer (reordering buffer)
Definition: tcp-socket-state.h:203
ns3::TcpGeneralTest::RttTrace
virtual void RttTrace(Time oldTime, Time newTime)
Rtt changes.
Definition: tcp-general-test.h:738
ns3::Packet::AddPacketTag
void AddPacketTag(const Tag &tag) const
Add a packet tag.
Definition: packet.cc:956
ns3::TcpSocketBase::m_rtt
Ptr< RttEstimator > m_rtt
Round trip time estimator.
Definition: tcp-socket-base.h:1285
ns3::TcpGeneralTest::GetPersistentTimeout
Time GetPersistentTimeout(SocketWho who)
Get the persistent timeout of the selected socket.
Definition: tcp-general-test.cc:833
NS_LOG_FUNCTION_NOARGS
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
Definition: log-macros-enabled.h:209
ns3::SequenceNumber::GetValue
NUMERIC_TYPE GetValue() const
Extracts the numeric value of the sequence number.
Definition: sequence-number.h:116
ns3::TcpSocketBase::m_minRto
Time m_minRto
minimum value of the Retransmit timeout
Definition: tcp-socket-base.h:1268
ns3::TcpSocketSmallAcks::m_bytesLeftToBeAcked
uint32_t m_bytesLeftToBeAcked
Number of bytes to be ACKed left.
Definition: tcp-general-test.h:211
ns3::TcpSocketMsgBase::SetForkCb
void SetForkCb(Callback< void, Ptr< TcpSocketMsgBase > > cb)
Set the callback invoked after the forking.
Definition: tcp-general-test.cc:1105
ns3::TcpGeneralTest::GetRto
Time GetRto(SocketWho who)
Get the retransmission time.
Definition: tcp-general-test.cc:694
ns3::TcpGeneralTest::DataSentCb
void DataSentCb(Ptr< Socket > socket, uint32_t size)
Data sent Callback.
Definition: tcp-general-test.cc:443
ns3::Socket::IsManualIpv6Tclass
bool IsManualIpv6Tclass(void) const
Checks if the socket has a specific IPv6 Tclass set.
Definition: socket.cc:371
ns3::TcpGeneralTest::CreateReceiverSocket
virtual Ptr< TcpSocketMsgBase > CreateReceiverSocket(Ptr< Node > node)
Create and install the socket to install on the receiver.
Definition: tcp-general-test.cc:330
ns3::TcpSocketState::UseEcn_t
UseEcn_t
Parameter value related to ECN enable/disable functionality similar to sysctl for tcp_ecn.
Definition: tcp-socket-state.h:113
ns3::Ipv4Address::GetAny
static Ipv4Address GetAny(void)
Definition: ipv4-address.cc:395
ns3::TcpSocketSmallAcks::m_lastAckedSeq
SequenceNumber32 m_lastAckedSeq
Last sequence number ACKed.
Definition: tcp-general-test.h:212
ns3::SocketIpv6TclassTag::SetTclass
void SetTclass(uint8_t tclass)
Set the tag's Tclass.
Definition: socket.cc:900
ns3::TcpCongestionOps
Congestion control abstract class.
Definition: tcp-congestion-ops.h:52
ns3::SocketIpTosTag
indicates whether the socket has IP_TOS set.
Definition: socket.h:1263
ns3::TcpGeneralTest::GetHighestTxMark
SequenceNumber32 GetHighestTxMark(SocketWho who)
Get the highest tx mark of the node specified.
Definition: tcp-general-test.cc:654
NS_LOG_DEBUG
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
ns3::TcpGeneralTest::SendPacket
void SendPacket(Ptr< Socket > socket, uint32_t pktSize, uint32_t pktCount, Time pktInterval)
Send packets to other endpoint.
Definition: tcp-general-test.cc:73
ns3::TcpSocketBase::m_delAckCount
uint32_t m_delAckCount
Delayed ACK counter.
Definition: tcp-socket-base.h:1254
ns3::TcpGeneralTest::QueueDropCb
void QueueDropCb(std::string context, Ptr< const Packet > p)
Queue Drop Callback.
Definition: tcp-general-test.cc:336
ns3::SocketIpTosTag::SetTos
void SetTos(uint8_t tos)
Set the tag's TOS.
Definition: socket.cc:785
ns3::TcpGeneralTest::GetDupAckCount
uint32_t GetDupAckCount(SocketWho who)
Get the number of dupack received.
Definition: tcp-general-test.cc:586
ns3::TcpGeneralTest::SsThreshTrace
virtual void SsThreshTrace(uint32_t oldValue, uint32_t newValue)
Slow start threshold changes.
Definition: tcp-general-test.h:752
ns3::TcpGeneralTest::GetDelAckCount
uint32_t GetDelAckCount(SocketWho who)
Get the number of delayed ack (if present)
Definition: tcp-general-test.cc:603
ns3::TcpGeneralTest::GetPersistentEvent
EventId GetPersistentEvent(SocketWho who)
Get the persistent event of the selected socket.
Definition: tcp-general-test.cc:815
ns3::TcpGeneralTest::UpdateRttHistoryCb
void UpdateRttHistoryCb(Ptr< const TcpSocketBase > tcp, const SequenceNumber32 &seq, uint32_t sz, bool isRetransmission)
Update RTT with new data.
Definition: tcp-general-test.cc:388
ns3::TcpGeneralTest::DoConnect
void DoConnect()
Scheduled at 0.0, SENDER starts the connection to RECEIVER.
Definition: tcp-general-test.cc:251
ns3::Seconds
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1289
ns3::ObjectBase::TraceConnect
bool TraceConnect(std::string name, std::string context, const CallbackBase &cb)
Connect a TraceSource to a Callback with a context.
Definition: object-base.cc:306
ns3::TcpSocketMsgBase::m_forkCb
Callback< void, Ptr< TcpSocketMsgBase > > m_forkCb
Fork callback.
Definition: tcp-general-test.h:146
ns3::TcpSocketBase::m_synCount
uint32_t m_synCount
Count of remaining connection retries.
Definition: tcp-socket-base.h:1261
ns3::TcpGeneralTest::QueueDrop
virtual void QueueDrop(SocketWho who)
Drop on the queue.
Definition: tcp-general-test.h:856
ns3::TcpSocketBase::m_rto
TracedValue< Time > m_rto
Retransmit timeout.
Definition: tcp-socket-base.h:1267
ns3::Ipv4AddressHelper::Assign
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
Definition: ipv4-address-helper.cc:135
ns3::SocketIpTtlTag
This class implements a tag that carries the socket-specific TTL of a packet to the IP layer.
Definition: socket.h:1117
ns3::TcpGeneralTest::m_congControlTypeId
TypeId m_congControlTypeId
Congestion control.
Definition: tcp-general-test.h:1036
ns3::TcpGeneralTest::m_interPacketInterval
Time m_interPacketInterval
Time between sending application packet down to tcp socket.
Definition: tcp-general-test.h:1049
ns3::Simulator::Destroy
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
Definition: simulator.cc:136
pktSize
uint32_t pktSize
packet size used for the simulation (in bytes)
Definition: wifi-bianchi.cc:86
ns3::TcpNewReno
The NewReno implementation.
Definition: tcp-congestion-ops.h:216
ns3::TcpClassicRecovery
The Classic recovery implementation.
Definition: tcp-recovery-ops.h:159
ns3::TimeValue
AttributeValue implementation for Time.
Definition: nstime.h:1353
segmentSize
uint32_t segmentSize
Definition: tcp-linux-reno.cc:53
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::TcpSocketSmallAcks::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition: tcp-general-test.cc:1144
ns3::TcpGeneralTest::GetReTxThreshold
uint32_t GetReTxThreshold(SocketWho who)
Get the retransmission threshold.
Definition: tcp-general-test.cc:569
ns3::NodeContainer
keep track of a set of node pointers.
Definition: node-container.h:39
ns3::TcpSocketBase::UpdateRttHistory
virtual void UpdateRttHistory(const SequenceNumber32 &seq, uint32_t sz, bool isRetransmission)
Update the RTT history, when we send TCP segments.
Definition: tcp-socket-base.cc:3173
ns3::TcpGeneralTest::SetAppPktSize
void SetAppPktSize(uint32_t pktSize)
Set app packet size.
Definition: tcp-general-test.h:641
ns3::Ipv4EndPoint::GetPeerPort
uint16_t GetPeerPort(void)
Get the peer port.
Definition: ipv4-end-point.cc:81
ns3::TcpSocketBase::m_txTrace
TracedCallback< Ptr< const Packet >, const TcpHeader &, Ptr< const TcpSocketBase > > m_txTrace
Trace of transmitted packets.
Definition: tcp-socket-base.h:1338
ns3::TcpSocketMsgBase::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition: tcp-general-test.cc:1041
ns3::Ipv4InterfaceContainer::GetAddress
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
Definition: ipv4-interface-container.cc:59
ns3::TcpL4Protocol
TCP socket creation and multiplexing/demultiplexing.
Definition: tcp-l4-protocol.h:80
ns3::TcpGeneralTest::AfterRetransmitCb
void AfterRetransmitCb(const Ptr< const TcpSocketState > tcb, const Ptr< const TcpSocketBase > tcp)
Invoked after a retransmit event.
Definition: tcp-general-test.cc:407
ns3::ObjectFactory::SetTypeId
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
Definition: object-factory.cc:40
ns3::TcpHeader::ACK
@ ACK
Ack.
Definition: tcp-header.h:286
ns3::TcpHeader::FIN
@ FIN
FIN.
Definition: tcp-header.h:282
ns3::TcpGeneralTest::GetInitialSsThresh
uint32_t GetInitialSsThresh(SocketWho who)
Get the initial slow start threshold.
Definition: tcp-general-test.cc:677
ns3::ObjectFactory::Create
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId.
Definition: object-factory.cc:98
ns3::TcpGeneralTest::SetUseEcn
void SetUseEcn(SocketWho who, TcpSocketState::UseEcn_t useEcn)
Forcefully set the ECN mode of use.
Definition: tcp-general-test.cc:971
ns3::Socket::m_boundnetdevice
Ptr< NetDevice > m_boundnetdevice
the device this socket is bound to (might be null).
Definition: socket.h:1077
ns3::TcpSocketBase::CloseAndNotify
void CloseAndNotify(void)
Peacefully close the socket by notifying the upper layer and deallocate end point.
Definition: tcp-socket-base.cc:1097
ns3::TcpHeader::SetWindowSize
void SetWindowSize(uint16_t windowSize)
Set the window size.
Definition: tcp-header.cc:119
ns3::TcpGeneralTest::m_propagationDelay
Time m_propagationDelay
Propagation delay of the channel.
Definition: tcp-general-test.h:1042
ns3::TcpSocketBase::m_synRetries
uint32_t m_synRetries
Number of connection attempts.
Definition: tcp-socket-base.h:1262
ns3::Ipv4EndPoint::GetPeerAddress
Ipv4Address GetPeerAddress(void)
Get the peer address.
Definition: ipv4-end-point.cc:74
ns3::TcpHeader::SetDestinationPort
void SetDestinationPort(uint16_t port)
Set the destination port.
Definition: tcp-header.cc:95
ns3::TcpGeneralTest::CreateReceiverErrorModel
virtual Ptr< ErrorModel > CreateReceiverErrorModel()
Create and return the error model to install in the receiver node.
Definition: tcp-general-test.cc:318
ns3::TcpGeneralTest::SetRecoveryAlgorithm
void SetRecoveryAlgorithm(TypeId recovery)
recovery algorithm of the sender socket
Definition: tcp-general-test.h:685
ns3::TcpGeneralTest::AfterRTOExpired
virtual void AfterRTOExpired(const Ptr< const TcpSocketState > tcb, SocketWho who)
Rto has expired.
Definition: tcp-general-test.h:928
ns3::TcpGeneralTest::SetInitialSsThresh
void SetInitialSsThresh(SocketWho who, uint32_t initialSsThresh)
Forcefully set the initial ssthresh.
Definition: tcp-general-test.cc:1022
ns3::InternetStackHelper
aggregate IP/TCP/UDP functionality to existing Nodes.
Definition: internet-stack-helper.h:88
ns3::Socket::IsManualIpTtl
bool IsManualIpTtl(void) const
Checks if the socket has a specific IPv4 TTL set.
Definition: socket.cc:377
ns3::Socket::GetIpTos
uint8_t GetIpTos(void) const
Query the value of IP Type of Service of this socket.
Definition: socket.cc:453
ns3::TcpSocketBase::m_cnTimeout
Time m_cnTimeout
Timeout for connection retry.
Definition: tcp-socket-base.h:1272
ns3::NetDeviceContainer::Get
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
Definition: net-device-container.cc:62
ns3::TcpGeneralTest::GetClockGranularity
Time GetClockGranularity(SocketWho who)
Get the clock granularity attribute.
Definition: tcp-general-test.cc:762
ns3::SequenceNumber< uint32_t, int32_t >
ns3::Socket::GetIpv6Tclass
uint8_t GetIpv6Tclass(void) const
Query the value of IPv6 Traffic Class field of this socket.
Definition: socket.cc:495
ns3::SocketIpv6HopLimitTag::SetHopLimit
void SetHopLimit(uint8_t hopLimit)
Set the tag's Hop Limit.
Definition: socket.cc:665
ns3::SimpleNetDevice::SetReceiveErrorModel
void SetReceiveErrorModel(Ptr< ErrorModel > em)
Attach a receive ErrorModel to the SimpleNetDevice.
Definition: simple-net-device.cc:298
ns3::Time::GetSeconds
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:380
ns3::TcpGeneralTest::GetTxBuffer
Ptr< TcpTxBuffer > GetTxBuffer(SocketWho who)
Get the Tx buffer from selected socket.
Definition: tcp-general-test.cc:887
ns3::TcpGeneralTest::GetRttEstimator
Ptr< RttEstimator > GetRttEstimator(SocketWho who)
Get the Rtt estimator of the socket.
Definition: tcp-general-test.cc:745
ns3::TcpSocket::TcpStates_t
TcpStates_t
Names of the 11 TCP states.
Definition: tcp-socket.h:65
ns3::TcpRecoveryOps
recovery abstract class
Definition: tcp-recovery-ops.h:61
ns3::EventId::IsExpired
bool IsExpired(void) const
This method is syntactic sugar for the ns3::Simulator::IsExpired method.
Definition: event-id.cc:65
ns3::TcpGeneralTest::CreateSenderSocket
virtual Ptr< TcpSocketMsgBase > CreateSenderSocket(Ptr< Node > node)
Create and install the socket to install on the sender.
Definition: tcp-general-test.cc:324
ns3::TcpGeneralTest::SetPropagationDelay
void SetPropagationDelay(Time propDelay)
Propagation delay of the bottleneck link.
Definition: tcp-general-test.h:664
ns3::SimpleNetDeviceHelper::SetNetDevicePointToPointMode
void SetNetDevicePointToPointMode(bool pointToPointMode)
SimpleNetDevice is Broadcast capable and ARP needing.
Definition: simple-net-device-helper.cc:94
ns3::TcpGeneralTest::SetSegmentSize
void SetSegmentSize(SocketWho who, uint32_t segmentSize)
Forcefully set the segment size.
Definition: tcp-general-test.cc:922