A Discrete-Event Network Simulator
API
tcp-dctcp-test.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2017 NITK Surathkal
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Shravya K.S. <shravya.ks0@gmail.com>
18 *
19 */
20
21#include "tcp-error-model.h"
22#include "tcp-general-test.h"
23
24#include "ns3/config.h"
25#include "ns3/ipv4-end-point.h"
26#include "ns3/ipv4.h"
27#include "ns3/ipv6-end-point.h"
28#include "ns3/ipv6.h"
29#include "ns3/log.h"
30#include "ns3/node.h"
31#include "ns3/tcp-dctcp.h"
32#include "ns3/tcp-l4-protocol.h"
33#include "ns3/tcp-linux-reno.h"
34#include "ns3/tcp-tx-buffer.h"
35
36using namespace ns3;
37
38NS_LOG_COMPONENT_DEFINE("TcpDctcpTestSuite");
39
47{
48 public:
55 TcpDctcpCodePointsTest(uint8_t testCase, const std::string& desc);
56
57 protected:
58 void Tx(const Ptr<const Packet> p, const TcpHeader& h, SocketWho who) override;
59 void Rx(const Ptr<const Packet> p, const TcpHeader& h, SocketWho who) override;
62 void ConfigureProperties() override;
63 void ConfigureEnvironment() override;
64
65 private:
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()),
96 0x1,
97 "IP TOS should have ECT1 for SYN packet for DCTCP traffic");
98 }
99 if (m_senderSent == 3)
100 {
101 NS_TEST_ASSERT_MSG_EQ(foundTag, true, "Tag not found");
102 NS_TEST_ASSERT_MSG_EQ(unsigned(ipTosTag.GetTos()),
103 0x1,
104 "IP TOS should have ECT1 for data packets for DCTCP traffic");
105 }
106 }
107 else
108 {
109 if (m_senderSent == 1)
110 {
112 foundTag,
113 false,
114 "IP TOS should not have ECT1 for SYN packet for DCTCP traffic");
115 }
116 if (m_senderSent == 3)
117 {
118 NS_TEST_ASSERT_MSG_EQ(foundTag, true, "Tag not found");
119 NS_TEST_ASSERT_MSG_EQ(unsigned(ipTosTag.GetTos()),
120 0x2,
121 "IP TOS should have ECT0 for data packets for non-DCTCP but "
122 "ECN enabled traffic");
123 }
124 }
125 }
126 else if (who == RECEIVER && (m_testCase == 1 || m_testCase == 2))
127 {
129 SocketIpTosTag ipTosTag;
130 foundTag = p->PeekPacketTag(ipTosTag);
131 if (m_testCase == 1)
132 {
133 if (m_receiverSent == 1)
134 {
135 NS_TEST_ASSERT_MSG_EQ(foundTag, true, "Tag not found");
137 unsigned(ipTosTag.GetTos()),
138 0x1,
139 "IP TOS should have ECT1 for SYN+ACK packet for DCTCP traffic");
140 }
141 if (m_receiverSent == 2)
142 {
143 NS_TEST_ASSERT_MSG_EQ(foundTag, true, "Tag not found");
145 unsigned(ipTosTag.GetTos()),
146 0x1,
147 "IP TOS should have ECT1 for pure ACK packets for DCTCP traffic");
148 }
149 }
150 else
151 {
152 if (m_receiverSent == 1)
153 {
154 NS_TEST_ASSERT_MSG_EQ(foundTag,
155 false,
156 "IP TOS should have neither ECT0 nor ECT1 for SYN+ACK packet "
157 "for non-DCTCP traffic");
158 }
159 if (m_receiverSent == 2)
160 {
161 NS_TEST_ASSERT_MSG_EQ(foundTag,
162 false,
163 "IP TOS should not have ECT1 for pure ACK packets for "
164 "non-DCTCP traffic but ECN enabled traffic");
165 }
166 }
167 }
168}
169
170void
172{
173 if (who == SENDER && m_testCase == 3)
174 {
176 if (m_senderReceived == 2 && m_testCase == 3)
177 {
179 ((h.GetFlags()) & TcpHeader::ECE),
180 0,
181 "The flag ECE should be set in TCP header of the packet sent by the receiver when "
182 "it receives a packet with CE bit set in IP header");
183 }
184 if (m_senderReceived > 2 && m_testCase == 3)
185 {
186 NS_TEST_ASSERT_MSG_EQ(((h.GetFlags()) & TcpHeader::ECE),
187 0,
188 "The flag ECE should be not be set in TCP header of the packet "
189 "sent by the receiver if it receives a packet without CE bit set "
190 "in IP header inspite of Sender not sending CWR flags to it");
191 }
192 }
193}
194
195void
197{
198 TcpGeneralTest::ConfigureProperties();
199 SetUseEcn(SENDER, TcpSocketState::On);
200 SetUseEcn(RECEIVER, TcpSocketState::On);
201}
202
203void
205{
206 TcpGeneralTest::ConfigureEnvironment();
207 Config::SetDefault("ns3::TcpDctcp::UseEct0", BooleanValue(false));
208}
209
222{
223 public:
228 static TypeId GetTypeId();
229
231 uint8_t m_testCase;
232
235 {
237 }
238
244 : TcpSocketMsgBase(other)
245 {
246 }
247
252 void SetTestCase(uint8_t testCase);
253
254 protected:
255 uint32_t SendDataPacket(SequenceNumber32 seq, uint32_t maxSize, bool withAck) override;
256 void ReTxTimeout() override;
257 Ptr<TcpSocketBase> Fork() override;
258};
259
261
262TypeId
264{
265 static TypeId tid = TypeId("ns3::TcpDctcpCongestedRouter")
267 .SetGroupName("Internet")
268 .AddConstructor<TcpDctcpCongestedRouter>();
269 return tid;
270}
271
272void
274{
275 TcpSocketBase::ReTxTimeout();
276}
277
278void
280{
281 m_testCase = testCase;
282}
283
286{
287 NS_LOG_FUNCTION(this << seq << maxSize << withAck);
289
290 bool isRetransmission = false;
291 if (seq != m_tcb->m_highTxMark)
292 {
293 isRetransmission = true;
294 }
295
296 Ptr<Packet> p = m_txBuffer->CopyFromSequence(maxSize, seq)->GetPacketCopy();
297 uint32_t sz = p->GetSize(); // Size of packet
298 uint8_t flags = withAck ? TcpHeader::ACK : 0;
299 uint32_t remainingData = m_txBuffer->SizeFromSequence(seq + SequenceNumber32(sz));
300
301 if (withAck)
302 {
304 m_delAckCount = 0;
305 }
306
307 // For test 3, we don't send CWR flags on receipt of ECE to check if Receiver sends ECE only
308 // when there is CE flags
309 if (m_tcb->m_ecnState == TcpSocketState::ECN_ECE_RCVD &&
310 m_ecnEchoSeq.Get() > m_ecnCWRSeq.Get() && !isRetransmission && m_testCase != 3)
311 {
312 NS_LOG_INFO("Backoff mechanism by reducing CWND by half because we've received ECN Echo");
314 flags |= TcpHeader::CWR;
315 m_ecnCWRSeq = seq;
316 m_tcb->m_ecnState = TcpSocketState::ECN_CWR_SENT;
317 NS_LOG_DEBUG(TcpSocketState::EcnStateName[m_tcb->m_ecnState] << " -> ECN_CWR_SENT");
318 NS_LOG_INFO("CWR flags set");
319 NS_LOG_DEBUG(TcpSocketState::TcpCongStateName[m_tcb->m_congState] << " -> CA_CWR");
320 if (m_tcb->m_congState == TcpSocketState::CA_OPEN)
321 {
322 m_congestionControl->CongestionStateSet(m_tcb, TcpSocketState::CA_CWR);
323 m_tcb->m_congState = TcpSocketState::CA_CWR;
324 }
325 }
326 /*
327 * Add tags for each socket option.
328 * Note that currently the socket adds both IPv4 tag and IPv6 tag
329 * if both options are set. Once the packet got to layer three, only
330 * the corresponding tags will be read.
331 */
332 if (GetIpTos())
333 {
334 SocketIpTosTag ipTosTag;
335
336 NS_LOG_LOGIC(" ECT bits should not be set on retransmitted packets ");
337 if (m_testCase == 3 && m_dataPacketSent == 1 && !isRetransmission)
338 {
339 ipTosTag.SetTos(GetIpTos() | 0x3);
340 }
341 else
342 {
343 if (m_tcb->m_ecnState != TcpSocketState::ECN_DISABLED && (GetIpTos() & 0x3) == 0 &&
344 !isRetransmission)
345 {
346 ipTosTag.SetTos(GetIpTos() | 0x1);
347 }
348 else
349 {
350 ipTosTag.SetTos(GetIpTos());
351 }
352 }
353 p->AddPacketTag(ipTosTag);
354 }
355 else
356 {
357 SocketIpTosTag ipTosTag;
358 if (m_testCase == 3 && m_dataPacketSent == 1 && !isRetransmission)
359 {
360 ipTosTag.SetTos(0x3);
361 }
362 else
363 {
364 if (m_tcb->m_ecnState != TcpSocketState::ECN_DISABLED && !isRetransmission)
365 {
366 ipTosTag.SetTos(0x1);
367 }
368 }
369 p->AddPacketTag(ipTosTag);
370 }
371
372 if (IsManualIpv6Tclass())
373 {
374 SocketIpv6TclassTag ipTclassTag;
375 if (m_testCase == 3 && m_dataPacketSent == 1 && !isRetransmission)
376 {
377 ipTclassTag.SetTclass(GetIpv6Tclass() | 0x3);
378 }
379 else
380 {
381 if (m_tcb->m_ecnState != TcpSocketState::ECN_DISABLED && (GetIpv6Tclass() & 0x3) == 0 &&
382 !isRetransmission)
383 {
384 ipTclassTag.SetTclass(GetIpv6Tclass() | 0x1);
385 }
386 else
387 {
388 ipTclassTag.SetTclass(GetIpv6Tclass());
389 }
390 }
391 p->AddPacketTag(ipTclassTag);
392 }
393 else
394 {
395 SocketIpv6TclassTag ipTclassTag;
396 if (m_testCase == 3 && m_dataPacketSent == 1 && !isRetransmission)
397 {
398 ipTclassTag.SetTclass(0x3);
399 }
400 else
401 {
402 if (m_tcb->m_ecnState != TcpSocketState::ECN_DISABLED && !isRetransmission)
403 {
404 ipTclassTag.SetTclass(0x1);
405 }
406 }
407 p->AddPacketTag(ipTclassTag);
408 }
409
410 if (IsManualIpTtl())
411 {
412 SocketIpTtlTag ipTtlTag;
413 ipTtlTag.SetTtl(GetIpTtl());
414 p->AddPacketTag(ipTtlTag);
415 }
416
418 {
419 SocketIpv6HopLimitTag ipHopLimitTag;
420 ipHopLimitTag.SetHopLimit(GetIpv6HopLimit());
421 p->AddPacketTag(ipHopLimitTag);
422 }
423
424 uint8_t priority = GetPriority();
425 if (priority)
426 {
427 SocketPriorityTag priorityTag;
428 priorityTag.SetPriority(priority);
429 p->ReplacePacketTag(priorityTag);
430 }
431
432 if (m_closeOnEmpty && (remainingData == 0))
433 {
434 flags |= TcpHeader::FIN;
435 if (m_state == ESTABLISHED)
436 { // On active close: I am the first one to send FIN
437 NS_LOG_DEBUG("ESTABLISHED -> FIN_WAIT_1");
439 }
440 else if (m_state == CLOSE_WAIT)
441 { // On passive close: Peer sent me FIN already
442 NS_LOG_DEBUG("CLOSE_WAIT -> LAST_ACK");
444 }
445 }
446 TcpHeader header;
447 header.SetFlags(flags);
448 header.SetSequenceNumber(seq);
449 header.SetAckNumber(m_tcb->m_rxBuffer->NextRxSequence());
450 if (m_endPoint)
451 {
454 }
455 else
456 {
459 }
461 AddOptions(header);
462
464 {
465 // Schedules retransmit timeout. m_rto should be already doubled.
466
467 NS_LOG_LOGIC(this << " SendDataPacket Schedule ReTxTimeout at time "
468 << Simulator::Now().GetSeconds() << " to expire at time "
469 << (Simulator::Now() + m_rto.Get()).GetSeconds());
470 m_retxEvent = Simulator::Schedule(m_rto, &TcpDctcpCongestedRouter::ReTxTimeout, this);
471 }
472
473 m_txTrace(p, header, this);
474
475 if (m_endPoint)
476 {
477 m_tcp->SendPacket(p,
478 header,
482 NS_LOG_DEBUG("Send segment of size "
483 << sz << " with remaining data " << remainingData << " via TcpL4Protocol to "
484 << m_endPoint->GetPeerAddress() << ". Header " << header);
485 }
486 else
487 {
488 m_tcp->SendPacket(p,
489 header,
493 NS_LOG_DEBUG("Send segment of size "
494 << sz << " with remaining data " << remainingData << " via TcpL4Protocol to "
495 << m_endPoint6->GetPeerAddress() << ". Header " << header);
496 }
497
498 UpdateRttHistory(seq, sz, isRetransmission);
499
500 // Notify the application of the data being sent unless this is a retransmit
501 if (seq + sz > m_tcb->m_highTxMark)
502 {
503 Simulator::ScheduleNow(&TcpDctcpCongestedRouter::NotifyDataSent,
504 this,
505 (seq + sz - m_tcb->m_highTxMark.Get()));
506 }
507 // Update highTxMark
509 return sz;
510}
511
514{
515 return CopyObject<TcpDctcpCongestedRouter>(this);
516}
517
520{
521 if (m_testCase == 2)
522 {
523 return TcpGeneralTest::CreateSenderSocket(node);
524 }
525 else if (m_testCase == 3)
526 {
527 Ptr<TcpDctcpCongestedRouter> socket = DynamicCast<TcpDctcpCongestedRouter>(
528 CreateSocket(node, TcpDctcpCongestedRouter::GetTypeId(), TcpDctcp::GetTypeId()));
529 socket->SetTestCase(m_testCase);
530 return socket;
531 }
532 else
533 {
534 return TcpGeneralTest::CreateSocket(node,
535 TcpSocketMsgBase::GetTypeId(),
536 TcpDctcp::GetTypeId());
537 }
538}
539
542{
543 if (m_testCase == 2)
544 {
545 return TcpGeneralTest::CreateReceiverSocket(node);
546 }
547 else
548 {
549 return TcpGeneralTest::CreateSocket(node,
550 TcpSocketMsgBase::GetTypeId(),
551 TcpDctcp::GetTypeId());
552 }
553}
554
562{
563 public:
578 uint32_t ssThresh,
579 uint32_t segmentsAcked,
580 SequenceNumber32 highTxMark,
581 SequenceNumber32 lastAckedSeq,
582 Time rtt,
583 const std::string& name);
584
585 private:
586 void DoRun() override;
589 void ExecuteTest();
590
599};
600
603 uint32_t ssThresh,
604 uint32_t segmentsAcked,
605 SequenceNumber32 highTxMark,
606 SequenceNumber32 lastAckedSeq,
607 Time rtt,
608 const std::string& name)
609 : TestCase(name),
610 m_cWnd(cWnd),
611 m_segmentSize(segmentSize),
612 m_segmentsAcked(segmentsAcked),
613 m_ssThresh(ssThresh),
614 m_rtt(rtt),
615 m_highTxMark(highTxMark),
616 m_lastAckedSeq(lastAckedSeq)
617{
618}
619
620void
622{
623 Simulator::Schedule(Seconds(0.0), &TcpDctcpToLinuxReno::ExecuteTest, this);
624 Simulator::Run();
625 Simulator::Destroy();
626}
627
628void
630{
631 m_state = CreateObject<TcpSocketState>();
637
638 Ptr<TcpSocketState> state = CreateObject<TcpSocketState>();
639 state->m_cWnd = m_cWnd;
640 state->m_ssThresh = m_ssThresh;
642 state->m_highTxMark = m_highTxMark;
644
645 Ptr<TcpDctcp> cong = CreateObject<TcpDctcp>();
646 cong->IncreaseWindow(m_state, m_segmentsAcked);
647
648 Ptr<TcpLinuxReno> LinuxRenoCong = CreateObject<TcpLinuxReno>();
649 LinuxRenoCong->IncreaseWindow(state, m_segmentsAcked);
650
652 state->m_cWnd.Get(),
653 "cWnd has not updated correctly");
654}
655
663{
664 public:
666 : TestSuite("tcp-dctcp-test", UNIT)
667 {
668 AddTestCase(new TcpDctcpToLinuxReno(2 * 1446,
669 1446,
670 4 * 1446,
671 2,
672 SequenceNumber32(4753),
673 SequenceNumber32(3216),
674 MilliSeconds(100),
675 "DCTCP falls to New Reno for slowstart"),
676 TestCase::QUICK);
678 "ECT Test : Check if ECT is set on Syn, Syn+Ack, "
679 "Ack and Data packets for DCTCP packets"),
680 TestCase::QUICK);
682 2,
683 "ECT Test : Check if ECT is not set on Syn, Syn+Ack and Ack but set on "
684 "Data packets for non-DCTCP but ECN enabled traffic"),
685 TestCase::QUICK);
687 "ECE Functionality Test: ECE should only be sent by "
688 "receiver when it receives CE flags"),
689 TestCase::QUICK);
690 }
691};
692
#define max(a, b)
Definition: 80211b.c:43
Validates the setting of ECT and ECE codepoints for DCTCP enabled traffic.
void ConfigureEnvironment() override
Change the configuration of the environment.
uint32_t m_receiverSent
Number of packets sent by the receiver.
uint8_t m_testCase
Test type.
TcpDctcpCodePointsTest(uint8_t testCase, const std::string &desc)
Constructor.
Ptr< TcpSocketMsgBase > CreateSenderSocket(Ptr< Node > node) override
Create and install the socket to install on the sender.
Ptr< TcpSocketMsgBase > CreateReceiverSocket(Ptr< Node > node) override
Create and install the socket to install on the receiver.
uint32_t m_senderReceived
Number of packets received by the sender.
void Rx(const Ptr< const Packet > p, const TcpHeader &h, SocketWho who) override
Packet received from IP layer.
void ConfigureProperties() override
Change the configuration of the socket properties.
void Tx(const Ptr< const Packet > p, const TcpHeader &h, SocketWho who) override
Packet transmitted down to IP layer.
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.
Ptr< TcpSocketBase > Fork() override
Call CopyObject<> to clone me.
static TypeId GetTypeId()
Get the type ID.
TcpDctcpCongestedRouter(const TcpDctcpCongestedRouter &other)
Constructor.
uint8_t m_testCase
Test type.
uint32_t SendDataPacket(SequenceNumber32 seq, uint32_t maxSize, bool withAck) override
Extract at most maxSize bytes from the TxBuffer at sequence seq, add the TCP header,...
void ReTxTimeout() override
An RTO event happened.
void SetTestCase(uint8_t testCase)
Set the test case type.
TCP DCTCP TestSuite.
DCTCP should be same as Linux during slow start.
uint32_t m_segmentsAcked
segments acked
uint32_t m_ssThresh
ss thresh
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()
Execute the test.
Ptr< TcpSocketState > m_state
state
SequenceNumber32 m_lastAckedSeq
last acked seq
SequenceNumber32 m_highTxMark
high tx mark
void DoRun() override
Implementation to actually run this TestCase.
uint32_t m_segmentSize
segment size
AttributeValue implementation for Boolean.
Definition: boolean.h:37
void Cancel()
This method is syntactic sugar for the ns3::Simulator::Cancel method.
Definition: event-id.cc:55
bool IsExpired() const
This method is syntactic sugar for the ns3::Simulator::IsExpired method.
Definition: event-id.cc:69
Ipv4Address GetPeerAddress()
Get the peer address.
uint16_t GetPeerPort()
Get the peer port.
uint16_t GetLocalPort()
Get the local port.
Ipv4Address GetLocalAddress()
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.
uint32_t GetSize() const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:863
void AddPacketTag(const Tag &tag) const
Add a packet tag.
Definition: packet.cc:979
bool PeekPacketTag(Tag &tag) const
Search a matching tag and call Tag::Deserialize if it is found.
Definition: packet.cc:1002
bool ReplacePacketTag(Tag &tag)
Replace the value of a packet tag.
Definition: packet.cc:994
bool IsManualIpTtl() const
Checks if the socket has a specific IPv4 TTL set.
Definition: socket.cc:372
virtual uint8_t GetIpTtl() const
Query the value of IP Time to Live field of this socket.
Definition: socket.cc:515
uint8_t GetIpTos() const
Query the value of IP Type of Service of this socket.
Definition: socket.cc:448
Ptr< NetDevice > m_boundnetdevice
the device this socket is bound to (might be null).
Definition: socket.h:1079
virtual uint8_t GetIpv6HopLimit() const
Query the value of IP Hop Limit field of this socket.
Definition: socket.cc:540
void NotifyDataSent(uint32_t size)
Notify through the callback (if set) that some data have been sent.
Definition: socket.cc:280
uint8_t GetPriority() const
Query the priority value of this socket.
Definition: socket.cc:391
uint8_t GetIpv6Tclass() const
Query the value of IPv6 Traffic Class field of this socket.
Definition: socket.cc:490
bool IsManualIpv6HopLimit() const
Checks if the socket has a specific IPv6 Hop Limit set.
Definition: socket.cc:378
bool IsManualIpv6Tclass() const
Checks if the socket has a specific IPv6 Tclass set.
Definition: socket.cc:366
indicates whether the socket has IP_TOS set.
Definition: socket.h:1269
void SetTos(uint8_t tos)
Set the tag's TOS.
Definition: socket.cc:796
uint8_t GetTos() const
Get the tag's TOS.
Definition: socket.cc:802
This class implements a tag that carries the socket-specific TTL of a packet to the IP layer.
Definition: socket.h:1122
void SetTtl(uint8_t ttl)
Set the tag's TTL.
Definition: socket.cc:602
This class implements a tag that carries the socket-specific HOPLIMIT of a packet to the IPv6 layer.
Definition: socket.h:1170
void SetHopLimit(uint8_t hopLimit)
Set the tag's Hop Limit.
Definition: socket.cc:666
indicates whether the socket has IPV6_TCLASS set.
Definition: socket.h:1364
void SetTclass(uint8_t tclass)
Set the tag's Tclass.
Definition: socket.cc:908
indicates whether the socket has a priority set.
Definition: socket.h:1316
void SetPriority(uint8_t priority)
Set the tag's priority.
Definition: socket.cc:852
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:46
void SetDestinationPort(uint16_t port)
Set the destination port.
Definition: tcp-header.cc:89
void SetSequenceNumber(SequenceNumber32 sequenceNumber)
Set the sequence Number.
Definition: tcp-header.cc:95
void SetFlags(uint8_t flags)
Set flags of the header.
Definition: tcp-header.cc:107
void SetWindowSize(uint16_t windowSize)
Set the window size.
Definition: tcp-header.cc:113
void SetSourcePort(uint16_t port)
Set the source port.
Definition: tcp-header.cc:83
void SetAckNumber(SequenceNumber32 ackNumber)
Set the ACK number.
Definition: tcp-header.cc:101
uint8_t GetFlags() const
Get the flags.
Definition: tcp-header.cc:167
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.
void UpdateRttHistory(const SequenceNumber32 &seq, uint32_t sz, bool isRetransmission) override
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:1060
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:305
A suite of tests to run.
Definition: test.h:1256
@ UNIT
This test suite implements a Unit Test.
Definition: test.h:1265
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:402
T Get() const
Get the underlying value.
Definition: traced-value.h:249
a unique identifier for an interface.
Definition: type-id.h:60
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:935
uint32_t segmentSize
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:891
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:268
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:282
#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:275
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
SequenceNumber< uint32_t, int32_t > SequenceNumber32
32 bit Sequence number.
Time Now()
create an ns3::Time instance which contains the current simulation time.
Definition: simulator.cc:296
@ ESTABLISHED
Connection established
Definition: tcp-socket.h:72
@ 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:73
@ FIN_WAIT_1
Our side has shutdown, waiting to complete transmission of remaining buffered data
Definition: tcp-socket.h:79
@ LAST_ACK
Our side has shutdown after remote has shutdown.
Definition: tcp-socket.h:76
#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:144
#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:564
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1338
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1350
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static TcpDctcpTestSuite g_tcpdctcpTest
static var for test initialization