A Discrete-Event Network Simulator
API
tcp-dctcp-test.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2017 NITK Surathkal
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  * Author: Shravya K.S. <shravya.ks0@gmail.com>
19  *
20  */
21 
22 #include "ns3/ipv4.h"
23 #include "ns3/ipv6.h"
24 #include "ns3/ipv4-end-point.h"
25 #include "ns3/ipv6-end-point.h"
26 #include "tcp-general-test.h"
27 #include "ns3/node.h"
28 #include "ns3/log.h"
29 #include "tcp-error-model.h"
30 #include "ns3/tcp-l4-protocol.h"
31 #include "ns3/tcp-dctcp.h"
32 #include "ns3/tcp-linux-reno.h"
33 #include "ns3/tcp-tx-buffer.h"
34 #include "ns3/config.h"
35 
36 using namespace ns3;
37 
38 NS_LOG_COMPONENT_DEFINE ("TcpDctcpTestSuite");
39 
47 {
48 public:
55  TcpDctcpCodePointsTest (uint8_t testCase, const std::string &desc);
56 
57 protected:
58  virtual void Tx (const Ptr<const Packet> p, const TcpHeader&h, SocketWho who);
59  virtual void Rx (const Ptr<const Packet> p, const TcpHeader&h, SocketWho who);
60  virtual Ptr<TcpSocketMsgBase> CreateSenderSocket (Ptr<Node> node);
61  virtual Ptr<TcpSocketMsgBase> CreateReceiverSocket (Ptr<Node> node);
62  void ConfigureProperties ();
63  void ConfigureEnvironment ();
64 
65 private:
69  uint8_t m_testCase;
70 };
71 
72 TcpDctcpCodePointsTest::TcpDctcpCodePointsTest (uint8_t testCase, const std::string &desc)
73  : TcpGeneralTest (desc),
74  m_senderSent (0),
75  m_receiverSent (0),
76  m_senderReceived (0),
77  m_testCase (testCase)
78 {
79 }
80 
81 void
83 {
84  bool foundTag = false; // IpTosTag will only be found if ECN bits are set
85  if (who == SENDER && (m_testCase == 1 || m_testCase == 2))
86  {
87  m_senderSent++;
88  SocketIpTosTag ipTosTag;
89  foundTag = p->PeekPacketTag (ipTosTag);
90  if (m_testCase == 1)
91  {
92  if (m_senderSent == 1)
93  {
94  NS_TEST_ASSERT_MSG_EQ (foundTag, true, "Tag not found");
95  NS_TEST_ASSERT_MSG_EQ (unsigned (ipTosTag.GetTos ()), 0x1, "IP TOS should have ECT1 for SYN packet for DCTCP traffic");
96  }
97  if (m_senderSent == 3)
98  {
99  NS_TEST_ASSERT_MSG_EQ (foundTag, true, "Tag not found");
100  NS_TEST_ASSERT_MSG_EQ (unsigned (ipTosTag.GetTos ()), 0x1, "IP TOS should have ECT1 for data packets for DCTCP traffic");
101  }
102  }
103  else
104  {
105  if (m_senderSent == 1)
106  {
107  NS_TEST_ASSERT_MSG_EQ (foundTag, false, "IP TOS should not have ECT1 for SYN packet for DCTCP traffic");
108  }
109  if (m_senderSent == 3)
110  {
111  NS_TEST_ASSERT_MSG_EQ (foundTag, true, "Tag not found");
112  NS_TEST_ASSERT_MSG_EQ (unsigned (ipTosTag.GetTos ()), 0x2, "IP TOS should have ECT0 for data packets for non-DCTCP but ECN enabled traffic");
113  }
114  }
115  }
116  else if (who == RECEIVER && (m_testCase == 1 || m_testCase == 2))
117  {
118  m_receiverSent++;
119  SocketIpTosTag ipTosTag;
120  foundTag = p->PeekPacketTag (ipTosTag);
121  if (m_testCase == 1)
122  {
123  if (m_receiverSent == 1)
124  {
125  NS_TEST_ASSERT_MSG_EQ (foundTag, true, "Tag not found");
126  NS_TEST_ASSERT_MSG_EQ (unsigned (ipTosTag.GetTos ()), 0x1, "IP TOS should have ECT1 for SYN+ACK packet for DCTCP traffic");
127  }
128  if (m_receiverSent == 2)
129  {
130  NS_TEST_ASSERT_MSG_EQ (foundTag, true, "Tag not found");
131  NS_TEST_ASSERT_MSG_EQ (unsigned (ipTosTag.GetTos ()), 0x1, "IP TOS should have ECT1 for pure ACK packets for DCTCP traffic");
132  }
133  }
134  else
135  {
136  if (m_receiverSent == 1)
137  {
138  NS_TEST_ASSERT_MSG_EQ (foundTag, false, "IP TOS should have neither ECT0 nor ECT1 for SYN+ACK packet for non-DCTCP traffic");
139  }
140  if (m_receiverSent == 2)
141  {
142  NS_TEST_ASSERT_MSG_EQ (foundTag, false, "IP TOS should not have ECT1 for pure ACK packets for non-DCTCP traffic but ECN enabled traffic");
143  }
144  }
145  }
146 }
147 
148 void
150 {
151  if (who == SENDER && m_testCase == 3)
152  {
154  if (m_senderReceived == 2 && m_testCase == 3)
155  {
156  NS_TEST_ASSERT_MSG_NE (((h.GetFlags ()) & TcpHeader::ECE), 0, "The flag ECE should be set in TCP header of the packet sent by the receiver when it receives a packet with CE bit set in IP header");
157  }
158  if (m_senderReceived > 2 && m_testCase == 3)
159  {
160  NS_TEST_ASSERT_MSG_EQ (((h.GetFlags ()) & TcpHeader::ECE), 0, "The flag ECE should be not be set in TCP header of the packet sent by the receiver if it receives a packet without CE bit set in IP header inspite of Sender not sending CWR flags to it");
161  }
162  }
163 }
164 
165 void
167 {
168  TcpGeneralTest::ConfigureProperties ();
169  SetUseEcn (SENDER, TcpSocketState::On);
170  SetUseEcn (RECEIVER, TcpSocketState::On);
171 }
172 
173 void
175 {
176  TcpGeneralTest::ConfigureEnvironment ();
177  Config::SetDefault ("ns3::TcpDctcp::UseEct0", BooleanValue (false));
178 }
179 
192 {
193 public:
198  static TypeId GetTypeId (void);
199 
201  uint8_t m_testCase;
202 
204  : TcpSocketMsgBase ()
205  {
206  m_dataPacketSent = 0;
207  }
208 
214  : TcpSocketMsgBase (other)
215  {
216  }
217 
222  void SetTestCase (uint8_t testCase);
223 protected:
224  virtual uint32_t SendDataPacket (SequenceNumber32 seq, uint32_t maxSize, bool withAck);
225  virtual void ReTxTimeout ();
226  Ptr<TcpSocketBase> Fork (void);
227 };
228 
230 
231 TypeId
233 {
234  static TypeId tid = TypeId ("ns3::TcpDctcpCongestedRouter")
236  .SetGroupName ("Internet")
237  .AddConstructor<TcpDctcpCongestedRouter> ()
238  ;
239  return tid;
240 }
241 
242 void
244 {
245  TcpSocketBase::ReTxTimeout ();
246 }
247 
248 void
250 {
251  m_testCase = testCase;
252 }
253 
254 uint32_t
256 {
257  NS_LOG_FUNCTION (this << seq << maxSize << withAck);
259 
260  bool isRetransmission = false;
261  if (seq != m_tcb->m_highTxMark)
262  {
263  isRetransmission = true;
264  }
265 
266  Ptr<Packet> p = m_txBuffer->CopyFromSequence (maxSize, seq)->GetPacketCopy ();
267  uint32_t sz = p->GetSize (); // Size of packet
268  uint8_t flags = withAck ? TcpHeader::ACK : 0;
269  uint32_t remainingData = m_txBuffer->SizeFromSequence (seq + SequenceNumber32 (sz));
270 
271  if (withAck)
272  {
274  m_delAckCount = 0;
275  }
276 
277  // For test 3, we don't send CWR flags on receipt of ECE to check if Receiver sends ECE only when there is CE flags
278  if (m_tcb->m_ecnState == TcpSocketState::ECN_ECE_RCVD && m_ecnEchoSeq.Get () > m_ecnCWRSeq.Get () && !isRetransmission && m_testCase != 3)
279  {
280  NS_LOG_INFO ("Backoff mechanism by reducing CWND by half because we've received ECN Echo");
282  flags |= TcpHeader::CWR;
283  m_ecnCWRSeq = seq;
284  m_tcb->m_ecnState = TcpSocketState::ECN_CWR_SENT;
285  NS_LOG_DEBUG (TcpSocketState::EcnStateName[m_tcb->m_ecnState] << " -> ECN_CWR_SENT");
286  NS_LOG_INFO ("CWR flags set");
287  NS_LOG_DEBUG (TcpSocketState::TcpCongStateName[m_tcb->m_congState] << " -> CA_CWR");
288  if (m_tcb->m_congState == TcpSocketState::CA_OPEN)
289  {
290  m_congestionControl->CongestionStateSet (m_tcb, TcpSocketState::CA_CWR);
291  m_tcb->m_congState = TcpSocketState::CA_CWR;
292  }
293  }
294  /*
295  * Add tags for each socket option.
296  * Note that currently the socket adds both IPv4 tag and IPv6 tag
297  * if both options are set. Once the packet got to layer three, only
298  * the corresponding tags will be read.
299  */
300  if (GetIpTos ())
301  {
302  SocketIpTosTag ipTosTag;
303 
304  NS_LOG_LOGIC (" ECT bits should not be set on retransmitted packets ");
305  if (m_testCase == 3 && m_dataPacketSent == 1 && !isRetransmission)
306  {
307  ipTosTag.SetTos (GetIpTos () | 0x3);
308  }
309  else
310  {
311  if (m_tcb->m_ecnState != TcpSocketState::ECN_DISABLED && (GetIpTos () & 0x3) == 0 && !isRetransmission)
312  {
313  ipTosTag.SetTos (GetIpTos () | 0x1);
314  }
315  else
316  {
317  ipTosTag.SetTos (GetIpTos ());
318  }
319  }
320  p->AddPacketTag (ipTosTag);
321  }
322  else
323  {
324  SocketIpTosTag ipTosTag;
325  if (m_testCase == 3 && m_dataPacketSent == 1 && !isRetransmission)
326  {
327  ipTosTag.SetTos (0x3);
328  }
329  else
330  {
331  if (m_tcb->m_ecnState != TcpSocketState::ECN_DISABLED && !isRetransmission)
332  {
333  ipTosTag.SetTos (0x1);
334  }
335  }
336  p->AddPacketTag (ipTosTag);
337  }
338 
339  if (IsManualIpv6Tclass ())
340  {
341  SocketIpv6TclassTag ipTclassTag;
342  if (m_testCase == 3 && m_dataPacketSent == 1 && !isRetransmission )
343  {
344  ipTclassTag.SetTclass (GetIpv6Tclass () | 0x3);
345  }
346  else
347  {
348  if (m_tcb->m_ecnState != TcpSocketState::ECN_DISABLED && (GetIpv6Tclass () & 0x3) == 0 && !isRetransmission)
349  {
350  ipTclassTag.SetTclass (GetIpv6Tclass () | 0x1);
351  }
352  else
353  {
354  ipTclassTag.SetTclass (GetIpv6Tclass ());
355  }
356  }
357  p->AddPacketTag (ipTclassTag);
358  }
359  else
360  {
361  SocketIpv6TclassTag ipTclassTag;
362  if (m_testCase == 3 && m_dataPacketSent == 1 && !isRetransmission)
363  {
364  ipTclassTag.SetTclass (0x3);
365  }
366  else
367  {
368  if (m_tcb->m_ecnState != TcpSocketState::ECN_DISABLED && !isRetransmission)
369  {
370  ipTclassTag.SetTclass (0x1);
371  }
372  }
373  p->AddPacketTag (ipTclassTag);
374  }
375 
376  if (IsManualIpTtl ())
377  {
378  SocketIpTtlTag ipTtlTag;
379  ipTtlTag.SetTtl (GetIpTtl ());
380  p->AddPacketTag (ipTtlTag);
381  }
382 
383  if (IsManualIpv6HopLimit ())
384  {
385  SocketIpv6HopLimitTag ipHopLimitTag;
386  ipHopLimitTag.SetHopLimit (GetIpv6HopLimit ());
387  p->AddPacketTag (ipHopLimitTag);
388  }
389 
390  uint8_t priority = GetPriority ();
391  if (priority)
392  {
393  SocketPriorityTag priorityTag;
394  priorityTag.SetPriority (priority);
395  p->ReplacePacketTag (priorityTag);
396  }
397 
398  if (m_closeOnEmpty && (remainingData == 0))
399  {
400  flags |= TcpHeader::FIN;
401  if (m_state == ESTABLISHED)
402  { // On active close: I am the first one to send FIN
403  NS_LOG_DEBUG ("ESTABLISHED -> FIN_WAIT_1");
405  }
406  else if (m_state == CLOSE_WAIT)
407  { // On passive close: Peer sent me FIN already
408  NS_LOG_DEBUG ("CLOSE_WAIT -> LAST_ACK");
409  m_state = LAST_ACK;
410  }
411  }
412  TcpHeader header;
413  header.SetFlags (flags);
414  header.SetSequenceNumber (seq);
415  header.SetAckNumber (m_tcb->m_rxBuffer->NextRxSequence ());
416  if (m_endPoint)
417  {
420  }
421  else
422  {
425  }
427  AddOptions (header);
428 
429  if (m_retxEvent.IsExpired ())
430  {
431  // Schedules retransmit timeout. m_rto should be already doubled.
432 
433  NS_LOG_LOGIC (this << " SendDataPacket Schedule ReTxTimeout at time " <<
434  Simulator::Now ().GetSeconds () << " to expire at time " <<
435  (Simulator::Now () + m_rto.Get ()).GetSeconds () );
436  m_retxEvent = Simulator::Schedule (m_rto, &TcpDctcpCongestedRouter::ReTxTimeout, this);
437  }
438 
439  m_txTrace (p, header, this);
440 
441  if (m_endPoint)
442  {
443  m_tcp->SendPacket (p, header, m_endPoint->GetLocalAddress (),
445  NS_LOG_DEBUG ("Send segment of size " << sz << " with remaining data " <<
446  remainingData << " via TcpL4Protocol to " << m_endPoint->GetPeerAddress () <<
447  ". Header " << header);
448  }
449  else
450  {
451  m_tcp->SendPacket (p, header, m_endPoint6->GetLocalAddress (),
453  NS_LOG_DEBUG ("Send segment of size " << sz << " with remaining data " <<
454  remainingData << " via TcpL4Protocol to " << m_endPoint6->GetPeerAddress () <<
455  ". Header " << header);
456  }
457 
458  UpdateRttHistory (seq, sz, isRetransmission);
459 
460  // Notify the application of the data being sent unless this is a retransmit
461  if (seq + sz > m_tcb->m_highTxMark)
462  {
463  Simulator::ScheduleNow (&TcpDctcpCongestedRouter::NotifyDataSent, this,
464  (seq + sz - m_tcb->m_highTxMark.Get ()));
465  }
466  // Update highTxMark
467  m_tcb->m_highTxMark = std::max (seq + sz, m_tcb->m_highTxMark.Get ());
468  return sz;
469 }
470 
473 {
474  return CopyObject<TcpDctcpCongestedRouter> (this);
475 }
476 
479 {
480  if (m_testCase == 2)
481  {
482  return TcpGeneralTest::CreateSenderSocket (node);
483  }
484  else if (m_testCase == 3)
485  {
486  Ptr<TcpDctcpCongestedRouter> socket = DynamicCast<TcpDctcpCongestedRouter> (
487  CreateSocket (node,
489  TcpDctcp::GetTypeId ()));
490  socket->SetTestCase (m_testCase);
491  return socket;
492  }
493  else
494  {
495  return TcpGeneralTest::CreateSocket (node, TcpSocketMsgBase::GetTypeId (), TcpDctcp::GetTypeId ());
496  }
497 }
498 
501 {
502  if (m_testCase == 2)
503  {
504  return TcpGeneralTest::CreateReceiverSocket (node);
505  }
506  else
507  {
508  return TcpGeneralTest::CreateSocket (node, TcpSocketMsgBase::GetTypeId (), TcpDctcp::GetTypeId ());
509  }
510 }
511 
519 {
520 public:
534  uint32_t segmentsAcked, SequenceNumber32 highTxMark,
535  SequenceNumber32 lastAckedSeq, Time rtt, const std::string &name);
536 
537 private:
538  virtual void DoRun (void);
541  void ExecuteTest (void);
542 
551 };
552 
554  uint32_t segmentsAcked, SequenceNumber32 highTxMark,
555  SequenceNumber32 lastAckedSeq, Time rtt, const std::string &name)
556  : TestCase (name),
557  m_cWnd (cWnd),
558  m_segmentSize (segmentSize),
559  m_segmentsAcked (segmentsAcked),
560  m_ssThresh (ssThresh),
561  m_rtt (rtt),
562  m_highTxMark (highTxMark),
563  m_lastAckedSeq (lastAckedSeq)
564 {
565 }
566 
567 void
569 {
570  Simulator::Schedule (Seconds (0.0), &TcpDctcpToLinuxReno::ExecuteTest, this);
571  Simulator::Run ();
572  Simulator::Destroy ();
573 }
574 
575 void
577 {
578  m_state = CreateObject <TcpSocketState> ();
579  m_state->m_cWnd = m_cWnd;
584 
585  Ptr<TcpSocketState> state = CreateObject <TcpSocketState> ();
586  state->m_cWnd = m_cWnd;
587  state->m_ssThresh = m_ssThresh;
588  state->m_segmentSize = m_segmentSize;
589  state->m_highTxMark = m_highTxMark;
591 
592  Ptr<TcpDctcp> cong = CreateObject <TcpDctcp> ();
594 
595  Ptr<TcpLinuxReno> LinuxRenoCong = CreateObject <TcpLinuxReno> ();
596  LinuxRenoCong->IncreaseWindow (state, m_segmentsAcked);
597 
599  "cWnd has not updated correctly");
600 }
601 
609 {
610 public:
611  TcpDctcpTestSuite () : TestSuite ("tcp-dctcp-test", UNIT)
612  {
613  AddTestCase (new TcpDctcpToLinuxReno (2 * 1446, 1446, 4 * 1446, 2, SequenceNumber32 (4753), SequenceNumber32 (3216), MilliSeconds (100), "DCTCP falls to New Reno for slowstart"), TestCase::QUICK);
614  AddTestCase (new TcpDctcpCodePointsTest (1, "ECT Test : Check if ECT is set on Syn, Syn+Ack, Ack and Data packets for DCTCP packets"),
615  TestCase::QUICK);
616  AddTestCase (new TcpDctcpCodePointsTest (2, "ECT Test : Check if ECT is not set on Syn, Syn+Ack and Ack but set on Data packets for non-DCTCP but ECN enabled traffic"),TestCase::QUICK);
617  AddTestCase (new TcpDctcpCodePointsTest (3, "ECE Functionality Test: ECE should only be sent by receiver when it receives CE flags"),
618  TestCase::QUICK);
619  }
620 };
621 
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::Packet::ReplacePacketTag
bool ReplacePacketTag(Tag &tag)
Replace the value of a packet tag.
Definition: packet.cc:970
TcpDctcpToLinuxReno::ExecuteTest
void ExecuteTest(void)
Execute the test.
Definition: tcp-dctcp-test.cc:576
ns3::TcpSocketBase::m_ecnCWRSeq
TracedValue< SequenceNumber32 > m_ecnCWRSeq
Sequence number of the last sent CWR.
Definition: tcp-socket-base.h:1349
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:3392
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::TcpHeader::SetSourcePort
void SetSourcePort(uint16_t port)
Set the source port.
Definition: tcp-header.cc:89
ns3::TestCase::AddTestCase
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:299
TcpDctcpCongestedRouter::m_testCase
uint8_t m_testCase
Test type.
Definition: tcp-dctcp-test.cc:201
ns3::TracedValue::Get
T Get(void) const
Get the underlying value.
Definition: traced-value.h:232
TcpDctcpCodePointsTest::m_senderSent
uint32_t m_senderSent
Number of packets sent by the sender.
Definition: tcp-dctcp-test.cc:66
TcpDctcpToLinuxReno::m_ssThresh
uint32_t m_ssThresh
ss thresh
Definition: tcp-dctcp-test.cc:546
TcpDctcpCodePointsTest::m_testCase
uint8_t m_testCase
Test type.
Definition: tcp-dctcp-test.cc:69
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
ns3::BooleanValue
AttributeValue implementation for Boolean.
Definition: boolean.h:37
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
Every class exported by the ns3 library is enclosed in the ns3 namespace.
TcpDctcpToLinuxReno::m_highTxMark
SequenceNumber32 m_highTxMark
high tx mark
Definition: tcp-dctcp-test.cc:548
ns3::TcpGeneralTest::SENDER
@ SENDER
Sender node.
Definition: tcp-general-test.h:276
ns3::TcpSocketState::m_highTxMark
TracedValue< SequenceNumber32 > m_highTxMark
Highest seqno ever sent, regardless of ReTx.
Definition: tcp-socket-state.h:184
TcpDctcpTestSuite::TcpDctcpTestSuite
TcpDctcpTestSuite()
Definition: tcp-dctcp-test.cc:611
TcpDctcpCodePointsTest::CreateReceiverSocket
virtual Ptr< TcpSocketMsgBase > CreateReceiverSocket(Ptr< Node > node)
Create and install the socket to install on the receiver.
Definition: tcp-dctcp-test.cc:500
TcpDctcpCongestedRouter::m_dataPacketSent
uint32_t m_dataPacketSent
Number of packets sent.
Definition: tcp-dctcp-test.cc:200
ns3::SocketIpTosTag::GetTos
uint8_t GetTos(void) const
Get the tag's TOS.
Definition: socket.cc:791
ns3::TcpSocketState::m_segmentSize
uint32_t m_segmentSize
Segment size.
Definition: tcp-socket-state.h:177
TcpDctcpCodePointsTest::ConfigureProperties
void ConfigureProperties()
Change the configuration of the socket properties.
Definition: tcp-dctcp-test.cc:166
ns3::Ipv6EndPoint::GetLocalAddress
Ipv6Address GetLocalAddress()
Get the local address.
Definition: ipv6-end-point.cc:52
ns3::TcpSocketMsgBase
Class for inserting callbacks special points of the flow of TCP sockets.
Definition: tcp-general-test.h:53
ns3::TcpGeneralTest::CreateSocket
virtual Ptr< TcpSocketMsgBase > CreateSocket(Ptr< Node > node, TypeId socketType, TypeId congControl)
Create a socket.
Definition: tcp-general-test.cc:278
ns3::TcpSocketBase::m_closeOnEmpty
bool m_closeOnEmpty
Close socket upon tx buffer emptied.
Definition: tcp-socket-base.h:1294
ns3::TcpSocketBase::m_ecnEchoSeq
TracedValue< SequenceNumber32 > m_ecnEchoSeq
Sequence number of the last received ECN Echo.
Definition: tcp-socket-base.h:1347
TcpDctcpToLinuxReno::DoRun
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition: tcp-dctcp-test.cc:568
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
TcpDctcpToLinuxReno::m_segmentSize
uint32_t m_segmentSize
segment size
Definition: tcp-dctcp-test.cc:544
ns3::TcpSocketBase::AddOptions
void AddOptions(TcpHeader &tcpHeader)
Add options to TcpHeader.
Definition: tcp-socket-base.cc:4083
ns3::TcpSocketState::m_lastAckedSeq
SequenceNumber32 m_lastAckedSeq
Last sequence ACKed.
Definition: tcp-socket-state.h:178
ns3::TcpSocketState::m_ecnState
TracedValue< EcnState_t > m_ecnState
Current ECN State, represented as combination of EcnState values.
Definition: tcp-socket-state.h:182
ns3::TcpSocketBase::m_retxEvent
EventId m_retxEvent
Retransmission event.
Definition: tcp-socket-base.h:1246
ns3::SocketIpTtlTag::SetTtl
void SetTtl(uint8_t ttl)
Set the tag's TTL.
Definition: socket.cc:604
ns3::TcpSocketBase::m_endPoint
Ipv4EndPoint * m_endPoint
the IPv4 endpoint
Definition: tcp-socket-base.h:1278
ns3::Packet::PeekPacketTag
bool PeekPacketTag(Tag &tag) const
Search a matching tag and call Tag::Deserialize if it is found.
Definition: packet.cc:978
ns3::TcpHeader::SetAckNumber
void SetAckNumber(SequenceNumber32 ackNumber)
Set the ACK number.
Definition: tcp-header.cc:107
TcpDctcpToLinuxReno::m_cWnd
uint32_t m_cWnd
cWnd
Definition: tcp-dctcp-test.cc:543
ns3::TcpSocketBase::m_tcb
Ptr< TcpSocketState > m_tcb
Congestion control information.
Definition: tcp-socket-base.h:1328
NS_TEST_ASSERT_MSG_NE
#define NS_TEST_ASSERT_MSG_NE(actual, limit, msg)
Test that an actual and expected (limit) value are not equal and report and abort if not.
Definition: test.h:542
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:922
TcpDctcpCongestedRouter
A TCP socket which sends a data packet with CE flags set for test 3.
Definition: tcp-dctcp-test.cc:192
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
TcpDctcpToLinuxReno::TcpDctcpToLinuxReno
TcpDctcpToLinuxReno(uint32_t cWnd, uint32_t segmentSize, uint32_t ssThresh, uint32_t segmentsAcked, SequenceNumber32 highTxMark, SequenceNumber32 lastAckedSeq, Time rtt, const std::string &name)
Constructor.
Definition: tcp-dctcp-test.cc:553
TcpDctcpToLinuxReno::m_state
Ptr< TcpSocketState > m_state
state
Definition: tcp-dctcp-test.cc:550
ns3::TestCase
encapsulates test code
Definition: test.h:994
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
TcpDctcpCodePointsTest::ConfigureEnvironment
void ConfigureEnvironment()
Change the configuration of the environment.
Definition: tcp-dctcp-test.cc:174
ns3::SocketPriorityTag::SetPriority
void SetPriority(uint8_t priority)
Set the tag's priority.
Definition: socket.cc:842
ns3::Ptr< const Packet >
ns3::TcpSocketBase::m_tcp
Ptr< TcpL4Protocol > m_tcp
the associated TCP L4 protocol
Definition: tcp-socket-base.h:1281
ns3::Ipv6EndPoint::GetPeerAddress
Ipv6Address GetPeerAddress()
Get the peer address.
Definition: ipv6-end-point.cc:72
ns3::Ipv4EndPoint::GetLocalPort
uint16_t GetLocalPort(void)
Get the local port.
Definition: ipv4-end-point.cc:67
ns3::TcpSocketState::m_congState
TracedValue< TcpCongState_t > m_congState
State in the Congestion state machine.
Definition: tcp-socket-state.h:180
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::TcpSocket::ESTABLISHED
@ ESTABLISHED
Connection established
Definition: tcp-socket.h:71
TcpDctcpCodePointsTest::m_senderReceived
uint32_t m_senderReceived
Number of packets received by the sender.
Definition: tcp-dctcp-test.cc:68
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:1118
ns3::Now
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
Definition: simulator.cc:287
max
#define max(a, b)
Definition: 80211b.c:43
TcpDctcpCodePointsTest::TcpDctcpCodePointsTest
TcpDctcpCodePointsTest(uint8_t testCase, const std::string &desc)
Constructor.
Definition: tcp-dctcp-test.cc:72
ns3::TcpSocketBase::m_delAckEvent
EventId m_delAckEvent
Delayed ACK timeout event.
Definition: tcp-socket-base.h:1248
NS_LOG_INFO
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:281
ns3::MilliSeconds
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1252
ns3::TcpSocketBase::m_endPoint6
Ipv6EndPoint * m_endPoint6
the IPv6 endpoint
Definition: tcp-socket-base.h:1279
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
ns3::Ipv6EndPoint::GetLocalPort
uint16_t GetLocalPort()
Get the local port.
Definition: ipv6-end-point.cc:62
ns3::TcpSocketBase::m_txBuffer
Ptr< TcpTxBuffer > m_txBuffer
Tx buffer.
Definition: tcp-socket-base.h:1288
tcp-error-model.h
ns3::Ipv6EndPoint::GetPeerPort
uint16_t GetPeerPort()
Get the peer port.
Definition: ipv6-end-point.cc:77
TcpDctcpTestSuite
TCP DCTCP TestSuite.
Definition: tcp-dctcp-test.cc:609
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::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::Time
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
ns3::TcpHeader
Header for the Transmission Control Protocol.
Definition: tcp-header.h:45
TcpDctcpToLinuxReno
DCTCP should be same as Linux during slow start.
Definition: tcp-dctcp-test.cc:519
tcp-general-test.h
TcpDctcpCongestedRouter::ReTxTimeout
virtual void ReTxTimeout()
An RTO event happened.
Definition: tcp-dctcp-test.cc:243
NS_LOG_LOGIC
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:289
ns3::TcpSocketBase::m_state
TracedValue< TcpStates_t > m_state
TCP state.
Definition: tcp-socket-base.h:1291
ns3::TcpGeneralTest
General infrastructure for TCP testing.
Definition: tcp-general-test.h:257
ns3::TcpSocketState::m_rxBuffer
Ptr< TcpRxBuffer > m_rxBuffer
Rx buffer (reordering buffer)
Definition: tcp-socket-state.h:203
ns3::Packet::AddPacketTag
void AddPacketTag(const Tag &tag) const
Add a packet tag.
Definition: packet.cc:956
ns3::TestSuite
A suite of tests to run.
Definition: test.h:1188
TcpDctcpToLinuxReno::m_lastAckedSeq
SequenceNumber32 m_lastAckedSeq
last acked seq
Definition: tcp-dctcp-test.cc:549
g_tcpdctcpTest
static TcpDctcpTestSuite g_tcpdctcpTest
static var for test initialization
Definition: tcp-dctcp-test.cc:622
uint32_t
ns3::SocketPriorityTag
indicates whether the socket has a priority set.
Definition: socket.h:1309
NS_TEST_ASSERT_MSG_EQ
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
Definition: test.h:141
ns3::TcpSocketBase::m_congestionControl
Ptr< TcpCongestionOps > m_congestionControl
Congestion control.
Definition: tcp-socket-base.h:1329
ns3::Socket::IsManualIpv6Tclass
bool IsManualIpv6Tclass(void) const
Checks if the socket has a specific IPv6 Tclass set.
Definition: socket.cc:371
TcpDctcpCongestedRouter::Fork
Ptr< TcpSocketBase > Fork(void)
Call CopyObject<> to clone me.
Definition: tcp-dctcp-test.cc:472
ns3::SocketIpv6TclassTag::SetTclass
void SetTclass(uint8_t tclass)
Set the tag's Tclass.
Definition: socket.cc:900
ns3::SocketIpTosTag
indicates whether the socket has IP_TOS set.
Definition: socket.h:1263
NS_LOG_DEBUG
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
ns3::TcpSocketBase::m_delAckCount
uint32_t m_delAckCount
Delayed ACK counter.
Definition: tcp-socket-base.h:1254
ns3::SocketIpTosTag::SetTos
void SetTos(uint8_t tos)
Set the tag's TOS.
Definition: socket.cc:785
ns3::TestSuite::UNIT
@ UNIT
This test suite implements a Unit Test.
Definition: test.h:1197
ns3::Seconds
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1244
TcpDctcpCongestedRouter::SetTestCase
void SetTestCase(uint8_t testCase)
Set the test case type.
Definition: tcp-dctcp-test.cc:249
ns3::TcpSocketBase::m_rto
TracedValue< Time > m_rto
Retransmit timeout.
Definition: tcp-socket-base.h:1267
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::Socket::GetPriority
uint8_t GetPriority(void) const
Query the priority value of this socket.
Definition: socket.cc:396
TcpDctcpCongestedRouter::TcpDctcpCongestedRouter
TcpDctcpCongestedRouter()
Definition: tcp-dctcp-test.cc:203
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::Ipv4EndPoint::GetPeerPort
uint16_t GetPeerPort(void)
Get the peer port.
Definition: ipv4-end-point.cc:81
ns3::TcpSocketState::m_cWnd
TracedValue< uint32_t > m_cWnd
Congestion window.
Definition: tcp-socket-state.h:165
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
TcpDctcpCodePointsTest
Validates the setting of ECT and ECE codepoints for DCTCP enabled traffic.
Definition: tcp-dctcp-test.cc:47
ns3::TcpHeader::GetFlags
uint8_t GetFlags() const
Get the flags.
Definition: tcp-header.cc:173
TcpDctcpCongestedRouter::SendDataPacket
virtual uint32_t SendDataPacket(SequenceNumber32 seq, uint32_t maxSize, bool withAck)
Extract at most maxSize bytes from the TxBuffer at sequence seq, add the TCP header,...
Definition: tcp-dctcp-test.cc:255
ns3::Config::SetDefault
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:849
ns3::TcpGeneralTest::SetUseEcn
void SetUseEcn(SocketWho who, TcpSocketState::UseEcn_t useEcn)
Forcefully set the ECN mode of use.
Definition: tcp-general-test.cc:970
ns3::Socket::m_boundnetdevice
Ptr< NetDevice > m_boundnetdevice
the device this socket is bound to (might be null).
Definition: socket.h:1077
TcpDctcpCongestedRouter::TcpDctcpCongestedRouter
TcpDctcpCongestedRouter(const TcpDctcpCongestedRouter &other)
Constructor.
Definition: tcp-dctcp-test.cc:213
ns3::TcpHeader::SetWindowSize
void SetWindowSize(uint16_t windowSize)
Set the window size.
Definition: tcp-header.cc:119
ns3::TcpLinuxReno::IncreaseWindow
virtual void IncreaseWindow(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked)
Congestion avoidance algorithm implementation.
Definition: tcp-linux-reno.cc:109
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
TcpDctcpCodePointsTest::Rx
virtual void Rx(const Ptr< const Packet > p, const TcpHeader &h, SocketWho who)
Packet received from IP layer.
Definition: tcp-dctcp-test.cc:149
TcpDctcpCodePointsTest::m_receiverSent
uint32_t m_receiverSent
Number of packets sent by the receiver.
Definition: tcp-dctcp-test.cc:67
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::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::SequenceNumber< uint32_t, int32_t >
TcpDctcpCongestedRouter::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition: tcp-dctcp-test.cc:232
ns3::TcpSocketState::m_ssThresh
TracedValue< uint32_t > m_ssThresh
Slow start threshold.
Definition: tcp-socket-state.h:167
TcpDctcpToLinuxReno::m_rtt
Time m_rtt
rtt
Definition: tcp-dctcp-test.cc:547
TcpDctcpCodePointsTest::Tx
virtual void Tx(const Ptr< const Packet > p, const TcpHeader &h, SocketWho who)
Packet transmitted down to IP layer.
Definition: tcp-dctcp-test.cc:82
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::Time::GetSeconds
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:379
ns3::EventId::IsExpired
bool IsExpired(void) const
This method is syntactic sugar for the ns3::Simulator::IsExpired method.
Definition: event-id.cc:65
TcpDctcpToLinuxReno::m_segmentsAcked
uint32_t m_segmentsAcked
segments acked
Definition: tcp-dctcp-test.cc:545
TcpDctcpCodePointsTest::CreateSenderSocket
virtual Ptr< TcpSocketMsgBase > CreateSenderSocket(Ptr< Node > node)
Create and install the socket to install on the sender.
Definition: tcp-dctcp-test.cc:478