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
36using namespace ns3;
37
38NS_LOG_COMPONENT_DEFINE ("TcpDctcpTestSuite");
39
47{
48public:
55 TcpDctcpCodePointsTest (uint8_t testCase, const std::string &desc);
56
57protected:
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);
62 void ConfigureProperties ();
64
65private:
69 uint8_t m_testCase;
70};
71
72TcpDctcpCodePointsTest::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
81void
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 {
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 {
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
148void
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
165void
167{
168 TcpGeneralTest::ConfigureProperties ();
169 SetUseEcn (SENDER, TcpSocketState::On);
170 SetUseEcn (RECEIVER, TcpSocketState::On);
171}
172
173void
175{
176 TcpGeneralTest::ConfigureEnvironment ();
177 Config::SetDefault ("ns3::TcpDctcp::UseEct0", BooleanValue (false));
178}
179
192{
193public:
198 static TypeId GetTypeId (void);
199
201 uint8_t m_testCase;
202
205 {
207 }
208
214 : TcpSocketMsgBase (other)
215 {
216 }
217
222 void SetTestCase (uint8_t testCase);
223protected:
224 virtual uint32_t SendDataPacket (SequenceNumber32 seq, uint32_t maxSize, bool withAck);
225 virtual void ReTxTimeout ();
227};
228
230
231TypeId
233{
234 static TypeId tid = TypeId ("ns3::TcpDctcpCongestedRouter")
236 .SetGroupName ("Internet")
237 .AddConstructor<TcpDctcpCongestedRouter> ()
238 ;
239 return tid;
240}
241
242void
244{
245 TcpSocketBase::ReTxTimeout ();
246}
247
248void
250{
251 m_testCase = testCase;
252}
253
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
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");
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{
520public:
534 uint32_t segmentsAcked, SequenceNumber32 highTxMark,
535 SequenceNumber32 lastAckedSeq, Time rtt, const std::string &name);
536
537private:
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
567void
569{
570 Simulator::Schedule (Seconds (0.0), &TcpDctcpToLinuxReno::ExecuteTest, this);
571 Simulator::Run ();
572 Simulator::Destroy ();
573}
574
575void
577{
578 m_state = CreateObject <TcpSocketState> ();
584
585 Ptr<TcpSocketState> state = CreateObject <TcpSocketState> ();
586 state->m_cWnd = m_cWnd;
587 state->m_ssThresh = m_ssThresh;
589 state->m_highTxMark = m_highTxMark;
591
592 Ptr<TcpDctcp> cong = CreateObject <TcpDctcp> ();
593 cong->IncreaseWindow (m_state, m_segmentsAcked);
594
595 Ptr<TcpLinuxReno> LinuxRenoCong = CreateObject <TcpLinuxReno> ();
596 LinuxRenoCong->IncreaseWindow (state, m_segmentsAcked);
597
599 "cWnd has not updated correctly");
600}
601
609{
610public:
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
#define max(a, b)
Definition: 80211b.c:43
Validates the setting of ECT and ECE codepoints for DCTCP enabled traffic.
void ConfigureEnvironment()
Change the configuration of the environment.
virtual void Tx(const Ptr< const Packet > p, const TcpHeader &h, SocketWho who)
Packet transmitted down to IP layer.
uint32_t m_receiverSent
Number of packets sent by the receiver.
uint8_t m_testCase
Test type.
virtual Ptr< TcpSocketMsgBase > CreateSenderSocket(Ptr< Node > node)
Create and install the socket to install on the sender.
TcpDctcpCodePointsTest(uint8_t testCase, const std::string &desc)
Constructor.
virtual Ptr< TcpSocketMsgBase > CreateReceiverSocket(Ptr< Node > node)
Create and install the socket to install on the receiver.
virtual void Rx(const Ptr< const Packet > p, const TcpHeader &h, SocketWho who)
Packet received from IP layer.
uint32_t m_senderReceived
Number of packets received by the sender.
void ConfigureProperties()
Change the configuration of the socket properties.
uint32_t m_senderSent
Number of packets sent by the sender.
A TCP socket which sends a data packet with CE flags set for test 3.
uint32_t m_dataPacketSent
Number of packets sent.
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,...
TcpDctcpCongestedRouter(const TcpDctcpCongestedRouter &other)
Constructor.
Ptr< TcpSocketBase > Fork(void)
Call CopyObject<> to clone me.
uint8_t m_testCase
Test type.
void SetTestCase(uint8_t testCase)
Set the test case type.
static TypeId GetTypeId(void)
Get the type ID.
virtual void ReTxTimeout()
An RTO event happened.
TCP DCTCP TestSuite.
DCTCP should be same as Linux during slow start.
uint32_t m_segmentsAcked
segments acked
uint32_t m_ssThresh
ss thresh
virtual void DoRun(void)
Implementation to actually run this TestCase.
TcpDctcpToLinuxReno(uint32_t cWnd, uint32_t segmentSize, uint32_t ssThresh, uint32_t segmentsAcked, SequenceNumber32 highTxMark, SequenceNumber32 lastAckedSeq, Time rtt, const std::string &name)
Constructor.
void ExecuteTest(void)
Execute the test.
Ptr< TcpSocketState > m_state
state
SequenceNumber32 m_lastAckedSeq
last acked seq
SequenceNumber32 m_highTxMark
high tx mark
uint32_t m_segmentSize
segment size
AttributeValue implementation for Boolean.
Definition: boolean.h:37
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::Cancel method.
Definition: event-id.cc:53
bool IsExpired(void) const
This method is syntactic sugar for the ns3::Simulator::IsExpired method.
Definition: event-id.cc:65
uint16_t GetPeerPort(void)
Get the peer port.
Ipv4Address GetPeerAddress(void)
Get the peer address.
uint16_t GetLocalPort(void)
Get the local port.
Ipv4Address GetLocalAddress(void)
Get the local address.
Ipv6Address GetLocalAddress()
Get the local address.
uint16_t GetLocalPort()
Get the local port.
Ipv6Address GetPeerAddress()
Get the peer address.
uint16_t GetPeerPort()
Get the peer port.
void AddPacketTag(const Tag &tag) const
Add a packet tag.
Definition: packet.cc:956
bool PeekPacketTag(Tag &tag) const
Search a matching tag and call Tag::Deserialize if it is found.
Definition: packet.cc:978
bool ReplacePacketTag(Tag &tag)
Replace the value of a packet tag.
Definition: packet.cc:970
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:856
bool IsManualIpv6HopLimit(void) const
Checks if the socket has a specific IPv6 Hop Limit set.
Definition: socket.cc:383
uint8_t GetIpv6Tclass(void) const
Query the value of IPv6 Traffic Class field of this socket.
Definition: socket.cc:495
uint8_t GetPriority(void) const
Query the priority value of this socket.
Definition: socket.cc:396
bool IsManualIpTtl(void) const
Checks if the socket has a specific IPv4 TTL set.
Definition: socket.cc:377
Ptr< NetDevice > m_boundnetdevice
the device this socket is bound to (might be null).
Definition: socket.h:1077
virtual uint8_t GetIpTtl(void) const
Query the value of IP Time to Live field of this socket.
Definition: socket.cc:520
virtual uint8_t GetIpv6HopLimit(void) const
Query the value of IP Hop Limit field of this socket.
Definition: socket.cc:545
bool IsManualIpv6Tclass(void) const
Checks if the socket has a specific IPv6 Tclass set.
Definition: socket.cc:371
void NotifyDataSent(uint32_t size)
Notify through the callback (if set) that some data have been sent.
Definition: socket.cc:285
uint8_t GetIpTos(void) const
Query the value of IP Type of Service of this socket.
Definition: socket.cc:453
indicates whether the socket has IP_TOS set.
Definition: socket.h:1263
void SetTos(uint8_t tos)
Set the tag's TOS.
Definition: socket.cc:785
uint8_t GetTos(void) const
Get the tag's TOS.
Definition: socket.cc:791
This class implements a tag that carries the socket-specific TTL of a packet to the IP layer.
Definition: socket.h:1117
void SetTtl(uint8_t ttl)
Set the tag's TTL.
Definition: socket.cc:604
This class implements a tag that carries the socket-specific HOPLIMIT of a packet to the IPv6 layer.
Definition: socket.h:1165
void SetHopLimit(uint8_t hopLimit)
Set the tag's Hop Limit.
Definition: socket.cc:665
indicates whether the socket has IPV6_TCLASS set.
Definition: socket.h:1356
void SetTclass(uint8_t tclass)
Set the tag's Tclass.
Definition: socket.cc:900
indicates whether the socket has a priority set.
Definition: socket.h:1309
void SetPriority(uint8_t priority)
Set the tag's priority.
Definition: socket.cc:842
General infrastructure for TCP testing.
SocketWho
Used as parameter of methods, specifies on what node the caller is interested (e.g.
@ RECEIVER
Receiver node.
virtual Ptr< TcpSocketMsgBase > CreateSocket(Ptr< Node > node, TypeId socketType, TypeId congControl)
Create a socket.
void SetUseEcn(SocketWho who, TcpSocketState::UseEcn_t useEcn)
Forcefully set the ECN mode of use.
Header for the Transmission Control Protocol.
Definition: tcp-header.h:45
void SetDestinationPort(uint16_t port)
Set the destination port.
Definition: tcp-header.cc:95
void SetSequenceNumber(SequenceNumber32 sequenceNumber)
Set the sequence Number.
Definition: tcp-header.cc:101
void SetFlags(uint8_t flags)
Set flags of the header.
Definition: tcp-header.cc:113
void SetWindowSize(uint16_t windowSize)
Set the window size.
Definition: tcp-header.cc:119
void SetSourcePort(uint16_t port)
Set the source port.
Definition: tcp-header.cc:89
void SetAckNumber(SequenceNumber32 ackNumber)
Set the ACK number.
Definition: tcp-header.cc:107
uint8_t GetFlags() const
Get the flags.
Definition: tcp-header.cc:173
Ptr< TcpCongestionOps > m_congestionControl
Congestion control.
TracedCallback< Ptr< const Packet >, const TcpHeader &, Ptr< const TcpSocketBase > > m_txTrace
Trace of transmitted packets.
Ptr< TcpL4Protocol > m_tcp
the associated TCP L4 protocol
Ptr< TcpSocketState > m_tcb
Congestion control information.
bool m_closeOnEmpty
Close socket upon tx buffer emptied.
TracedValue< Time > m_rto
Retransmit timeout.
Ptr< TcpTxBuffer > m_txBuffer
Tx buffer.
EventId m_delAckEvent
Delayed ACK timeout event.
void AddOptions(TcpHeader &tcpHeader)
Add options to TcpHeader.
TracedValue< TcpStates_t > m_state
TCP state.
EventId m_retxEvent
Retransmission event.
TracedValue< SequenceNumber32 > m_ecnCWRSeq
Sequence number of the last sent CWR.
uint32_t m_delAckCount
Delayed ACK counter.
Ipv4EndPoint * m_endPoint
the IPv4 endpoint
virtual uint16_t AdvertisedWindowSize(bool scale=true) const
The amount of Rx window announced to the peer.
Ipv6EndPoint * m_endPoint6
the IPv6 endpoint
TracedValue< SequenceNumber32 > m_ecnEchoSeq
Sequence number of the last received ECN Echo.
Class for inserting callbacks special points of the flow of TCP sockets.
virtual void UpdateRttHistory(const SequenceNumber32 &seq, uint32_t sz, bool isRetransmission)
Update the RTT history, when we send TCP segments.
uint32_t m_segmentSize
Segment size.
TracedValue< SequenceNumber32 > m_highTxMark
Highest seqno ever sent, regardless of ReTx.
TracedValue< TcpCongState_t > m_congState
State in the Congestion state machine.
SequenceNumber32 m_lastAckedSeq
Last sequence ACKed.
TracedValue< uint32_t > m_cWnd
Congestion window.
Ptr< TcpRxBuffer > m_rxBuffer
Rx buffer (reordering buffer)
TracedValue< EcnState_t > m_ecnState
Current ECN State, represented as combination of EcnState values.
TracedValue< uint32_t > m_ssThresh
Slow start threshold.
encapsulates test code
Definition: test.h:994
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:299
A suite of tests to run.
Definition: test.h:1188
@ UNIT
This test suite implements a Unit Test.
Definition: test.h:1197
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:379
T Get(void) const
Get the underlying value.
Definition: traced-value.h:232
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:922
uint32_t segmentSize
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:849
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:289
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:281
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
Definition: simulator.cc:287
@ ESTABLISHED
Connection established
Definition: tcp-socket.h:71
@ 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
@ FIN_WAIT_1
Our side has shutdown, waiting to complete transmission of remaining buffered data
Definition: tcp-socket.h:78
@ LAST_ACK
Our side has shutdown after remote has shutdown.
Definition: tcp-socket.h:75
#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
#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
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1244
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1252
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static TcpDctcpTestSuite g_tcpdctcpTest
static var for test initialization