A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
tcp-dctcp-test.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2017 NITK Surathkal
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Shravya K.S. <shravya.ks0@gmail.com>
7 *
8 */
9
10#include "tcp-error-model.h"
11#include "tcp-general-test.h"
12
13#include "ns3/config.h"
14#include "ns3/ipv4-end-point.h"
15#include "ns3/ipv4.h"
16#include "ns3/ipv6-end-point.h"
17#include "ns3/ipv6.h"
18#include "ns3/log.h"
19#include "ns3/node.h"
20#include "ns3/tcp-dctcp.h"
21#include "ns3/tcp-l4-protocol.h"
22#include "ns3/tcp-linux-reno.h"
23#include "ns3/tcp-tx-buffer.h"
24
25using namespace ns3;
26
27NS_LOG_COMPONENT_DEFINE("TcpDctcpTestSuite");
28
29/**
30 * \ingroup internet-test
31 *
32 * \brief Validates the setting of ECT and ECE codepoints for DCTCP enabled traffic
33 */
35{
36 public:
37 /**
38 * \brief Constructor
39 *
40 * \param testCase Test case number
41 * \param desc Description about the test
42 */
43 TcpDctcpCodePointsTest(uint8_t testCase, const std::string& desc);
44
45 protected:
46 void Tx(const Ptr<const Packet> p, const TcpHeader& h, SocketWho who) override;
47 void Rx(const Ptr<const Packet> p, const TcpHeader& h, SocketWho who) override;
50 void ConfigureProperties() override;
51 void ConfigureEnvironment() override;
52
53 private:
54 uint32_t m_senderSent; //!< Number of packets sent by the sender
55 uint32_t m_receiverSent; //!< Number of packets sent by the receiver
56 uint32_t m_senderReceived; //!< Number of packets received by the sender
57 uint8_t m_testCase; //!< Test type
58};
59
60TcpDctcpCodePointsTest::TcpDctcpCodePointsTest(uint8_t testCase, const std::string& desc)
61 : TcpGeneralTest(desc),
62 m_senderSent(0),
63 m_receiverSent(0),
64 m_senderReceived(0),
65 m_testCase(testCase)
66{
67}
68
69void
71{
72 bool foundTag = false; // IpTosTag will only be found if ECN bits are set
73 if (who == SENDER && (m_testCase == 1 || m_testCase == 2))
74 {
76 SocketIpTosTag ipTosTag;
77 foundTag = p->PeekPacketTag(ipTosTag);
78 if (m_testCase == 1)
79 {
80 if (m_senderSent == 1)
81 {
82 NS_TEST_ASSERT_MSG_EQ(foundTag, true, "Tag not found");
83 NS_TEST_ASSERT_MSG_EQ(unsigned(ipTosTag.GetTos()),
84 0x1,
85 "IP TOS should have ECT1 for SYN packet for DCTCP traffic");
86 }
87 if (m_senderSent == 3)
88 {
89 NS_TEST_ASSERT_MSG_EQ(foundTag, true, "Tag not found");
90 NS_TEST_ASSERT_MSG_EQ(unsigned(ipTosTag.GetTos()),
91 0x1,
92 "IP TOS should have ECT1 for data packets for DCTCP traffic");
93 }
94 }
95 else
96 {
97 if (m_senderSent == 1)
98 {
100 foundTag,
101 false,
102 "IP TOS should not have ECT1 for SYN packet for DCTCP traffic");
103 }
104 if (m_senderSent == 3)
105 {
106 NS_TEST_ASSERT_MSG_EQ(foundTag, true, "Tag not found");
107 NS_TEST_ASSERT_MSG_EQ(unsigned(ipTosTag.GetTos()),
108 0x2,
109 "IP TOS should have ECT0 for data packets for non-DCTCP but "
110 "ECN enabled traffic");
111 }
112 }
113 }
114 else if (who == RECEIVER && (m_testCase == 1 || m_testCase == 2))
115 {
117 SocketIpTosTag ipTosTag;
118 foundTag = p->PeekPacketTag(ipTosTag);
119 if (m_testCase == 1)
120 {
121 if (m_receiverSent == 1)
122 {
123 NS_TEST_ASSERT_MSG_EQ(foundTag, true, "Tag not found");
125 unsigned(ipTosTag.GetTos()),
126 0x1,
127 "IP TOS should have ECT1 for SYN+ACK packet for DCTCP traffic");
128 }
129 if (m_receiverSent == 2)
130 {
131 NS_TEST_ASSERT_MSG_EQ(foundTag, true, "Tag not found");
133 unsigned(ipTosTag.GetTos()),
134 0x1,
135 "IP TOS should have ECT1 for pure ACK packets for DCTCP traffic");
136 }
137 }
138 else
139 {
140 if (m_receiverSent == 1)
141 {
142 NS_TEST_ASSERT_MSG_EQ(foundTag,
143 false,
144 "IP TOS should have neither ECT0 nor ECT1 for SYN+ACK packet "
145 "for non-DCTCP traffic");
146 }
147 if (m_receiverSent == 2)
148 {
149 NS_TEST_ASSERT_MSG_EQ(foundTag,
150 false,
151 "IP TOS should not have ECT1 for pure ACK packets for "
152 "non-DCTCP traffic but ECN enabled traffic");
153 }
154 }
155 }
156}
157
158void
160{
161 if (who == SENDER && m_testCase == 3)
162 {
164 if (m_senderReceived == 2 && m_testCase == 3)
165 {
167 ((h.GetFlags()) & TcpHeader::ECE),
168 0,
169 "The flag ECE should be set in TCP header of the packet sent by the receiver when "
170 "it receives a packet with CE bit set in IP header");
171 }
172 if (m_senderReceived > 2 && m_testCase == 3)
173 {
175 0,
176 "The flag ECE should be not be set in TCP header of the packet "
177 "sent by the receiver if it receives a packet without CE bit set "
178 "in IP header in spite of Sender not sending CWR flags to it");
179 }
180 }
181}
182
183void
190
191void
197
198/**
199 * \ingroup internet-test
200 *
201 * \brief A TCP socket which sends a data packet with CE flags set for test 3.
202 *
203 * The SendDataPacket function of this class sends data packet numbered 1 with CE flags set and
204 * also doesn't set CWR flags on receipt of ECE flags for test 3. This is done to verify that DCTCP
205 * receiver sends ECE only if it receives CE in spite of sender not sending CWR flags for ECE
206 *
207 */
209{
210 public:
211 /**
212 * \brief Get the type ID.
213 * \return the object TypeId
214 */
215 static TypeId GetTypeId();
216
217 uint32_t m_dataPacketSent; //!< Number of packets sent
218 uint8_t m_testCase; //!< Test type
219
225
226 /**
227 * \brief Constructor.
228 * \param other The object to copy from.
229 */
234
235 /**
236 * Set the test case type
237 * \param testCase test case type
238 */
239 void SetTestCase(uint8_t testCase);
240
241 protected:
242 uint32_t SendDataPacket(SequenceNumber32 seq, uint32_t maxSize, bool withAck) override;
243 void ReTxTimeout() override;
244 Ptr<TcpSocketBase> Fork() override;
245};
246
248
249TypeId
251{
252 static TypeId tid = TypeId("ns3::TcpDctcpCongestedRouter")
254 .SetGroupName("Internet")
255 .AddConstructor<TcpDctcpCongestedRouter>();
256 return tid;
257}
258
259void
264
265void
267{
268 m_testCase = testCase;
269}
270
273{
274 NS_LOG_FUNCTION(this << seq << maxSize << withAck);
276
277 bool isRetransmission = false;
278 if (seq != m_tcb->m_highTxMark)
279 {
280 isRetransmission = true;
281 }
282
283 Ptr<Packet> p = m_txBuffer->CopyFromSequence(maxSize, seq)->GetPacketCopy();
284 uint32_t sz = p->GetSize(); // Size of packet
285 uint8_t flags = withAck ? TcpHeader::ACK : 0;
286 uint32_t remainingData = m_txBuffer->SizeFromSequence(seq + SequenceNumber32(sz));
287
288 if (withAck)
289 {
291 m_delAckCount = 0;
292 }
293
294 // For test 3, we don't send CWR flags on receipt of ECE to check if Receiver sends ECE only
295 // when there is CE flags
296 if (m_tcb->m_ecnState == TcpSocketState::ECN_ECE_RCVD &&
297 m_ecnEchoSeq.Get() > m_ecnCWRSeq.Get() && !isRetransmission && m_testCase != 3)
298 {
299 NS_LOG_INFO("Backoff mechanism by reducing CWND by half because we've received ECN Echo");
300 m_tcb->m_ssThresh = m_tcb->m_cWnd;
301 flags |= TcpHeader::CWR;
302 m_ecnCWRSeq = seq;
304 NS_LOG_DEBUG(TcpSocketState::EcnStateName[m_tcb->m_ecnState] << " -> ECN_CWR_SENT");
305 NS_LOG_INFO("CWR flags set");
306 NS_LOG_DEBUG(TcpSocketState::TcpCongStateName[m_tcb->m_congState] << " -> CA_CWR");
307 if (m_tcb->m_congState == TcpSocketState::CA_OPEN)
308 {
310 m_tcb->m_congState = TcpSocketState::CA_CWR;
311 }
312 }
313 /*
314 * Add tags for each socket option.
315 * Note that currently the socket adds both IPv4 tag and IPv6 tag
316 * if both options are set. Once the packet got to layer three, only
317 * the corresponding tags will be read.
318 */
319 if (GetIpTos())
320 {
321 SocketIpTosTag ipTosTag;
322
323 NS_LOG_LOGIC(" ECT bits should not be set on retransmitted packets ");
324 if (m_testCase == 3 && m_dataPacketSent == 1 && !isRetransmission)
325 {
326 ipTosTag.SetTos(GetIpTos() | 0x3);
327 }
328 else
329 {
330 if (m_tcb->m_ecnState != TcpSocketState::ECN_DISABLED && (GetIpTos() & 0x3) == 0 &&
331 !isRetransmission)
332 {
333 ipTosTag.SetTos(GetIpTos() | 0x1);
334 }
335 else
336 {
337 ipTosTag.SetTos(GetIpTos());
338 }
339 }
340 p->AddPacketTag(ipTosTag);
341 }
342 else
343 {
344 SocketIpTosTag ipTosTag;
345 if (m_testCase == 3 && m_dataPacketSent == 1 && !isRetransmission)
346 {
347 ipTosTag.SetTos(0x3);
348 }
349 else
350 {
351 if (m_tcb->m_ecnState != TcpSocketState::ECN_DISABLED && !isRetransmission)
352 {
353 ipTosTag.SetTos(0x1);
354 }
355 }
356 p->AddPacketTag(ipTosTag);
357 }
358
359 if (IsManualIpv6Tclass())
360 {
361 SocketIpv6TclassTag ipTclassTag;
362 if (m_testCase == 3 && m_dataPacketSent == 1 && !isRetransmission)
363 {
364 ipTclassTag.SetTclass(GetIpv6Tclass() | 0x3);
365 }
366 else
367 {
368 if (m_tcb->m_ecnState != TcpSocketState::ECN_DISABLED && (GetIpv6Tclass() & 0x3) == 0 &&
369 !isRetransmission)
370 {
371 ipTclassTag.SetTclass(GetIpv6Tclass() | 0x1);
372 }
373 else
374 {
375 ipTclassTag.SetTclass(GetIpv6Tclass());
376 }
377 }
378 p->AddPacketTag(ipTclassTag);
379 }
380 else
381 {
382 SocketIpv6TclassTag ipTclassTag;
383 if (m_testCase == 3 && m_dataPacketSent == 1 && !isRetransmission)
384 {
385 ipTclassTag.SetTclass(0x3);
386 }
387 else
388 {
389 if (m_tcb->m_ecnState != TcpSocketState::ECN_DISABLED && !isRetransmission)
390 {
391 ipTclassTag.SetTclass(0x1);
392 }
393 }
394 p->AddPacketTag(ipTclassTag);
395 }
396
397 if (IsManualIpTtl())
398 {
399 SocketIpTtlTag ipTtlTag;
400 ipTtlTag.SetTtl(GetIpTtl());
401 p->AddPacketTag(ipTtlTag);
402 }
403
405 {
406 SocketIpv6HopLimitTag ipHopLimitTag;
407 ipHopLimitTag.SetHopLimit(GetIpv6HopLimit());
408 p->AddPacketTag(ipHopLimitTag);
409 }
410
411 uint8_t priority = GetPriority();
412 if (priority)
413 {
414 SocketPriorityTag priorityTag;
415 priorityTag.SetPriority(priority);
416 p->ReplacePacketTag(priorityTag);
417 }
418
419 if (m_closeOnEmpty && (remainingData == 0))
420 {
421 flags |= TcpHeader::FIN;
422 if (m_state == ESTABLISHED)
423 { // On active close: I am the first one to send FIN
424 NS_LOG_DEBUG("ESTABLISHED -> FIN_WAIT_1");
426 }
427 else if (m_state == CLOSE_WAIT)
428 { // On passive close: Peer sent me FIN already
429 NS_LOG_DEBUG("CLOSE_WAIT -> LAST_ACK");
431 }
432 }
433 TcpHeader header;
434 header.SetFlags(flags);
435 header.SetSequenceNumber(seq);
436 header.SetAckNumber(m_tcb->m_rxBuffer->NextRxSequence());
437 if (m_endPoint)
438 {
441 }
442 else
443 {
446 }
448 AddOptions(header);
449
451 {
452 // Schedules retransmit timeout. m_rto should be already doubled.
453
454 NS_LOG_LOGIC(this << " SendDataPacket Schedule ReTxTimeout at time "
455 << Simulator::Now().GetSeconds() << " to expire at time "
456 << (Simulator::Now() + m_rto.Get()).GetSeconds());
458 }
459
460 m_txTrace(p, header, this);
461
462 if (m_endPoint)
463 {
464 m_tcp->SendPacket(p,
465 header,
469 NS_LOG_DEBUG("Send segment of size "
470 << sz << " with remaining data " << remainingData << " via TcpL4Protocol to "
471 << m_endPoint->GetPeerAddress() << ". Header " << header);
472 }
473 else
474 {
475 m_tcp->SendPacket(p,
476 header,
480 NS_LOG_DEBUG("Send segment of size "
481 << sz << " with remaining data " << remainingData << " via TcpL4Protocol to "
482 << m_endPoint6->GetPeerAddress() << ". Header " << header);
483 }
484
485 UpdateRttHistory(seq, sz, isRetransmission);
486
487 // Notify the application of the data being sent unless this is a retransmit
488 if (seq + sz > m_tcb->m_highTxMark)
489 {
491 this,
492 (seq + sz - m_tcb->m_highTxMark.Get()));
493 }
494 // Update highTxMark
495 m_tcb->m_highTxMark = std::max(seq + sz, m_tcb->m_highTxMark.Get());
496 return sz;
497}
498
504
507{
508 if (m_testCase == 2)
509 {
511 }
512 else if (m_testCase == 3)
513 {
516 socket->SetTestCase(m_testCase);
517 return socket;
518 }
519 else
520 {
524 }
525}
526
529{
530 if (m_testCase == 2)
531 {
533 }
534 else
535 {
539 }
540}
541
542/**
543 * \ingroup internet-test
544 *
545 * \brief DCTCP should be same as Linux during slow start
546 */
548{
549 public:
550 /**
551 * \brief Constructor
552 *
553 * \param cWnd congestion window
554 * \param segmentSize segment size
555 * \param ssThresh slow start threshold
556 * \param segmentsAcked segments acked
557 * \param highTxMark high tx mark
558 * \param lastAckedSeq last acked seq
559 * \param rtt RTT
560 * \param name Name of the test
561 */
564 uint32_t ssThresh,
565 uint32_t segmentsAcked,
566 SequenceNumber32 highTxMark,
567 SequenceNumber32 lastAckedSeq,
568 Time rtt,
569 const std::string& name);
570
571 private:
572 void DoRun() override;
573 /** \brief Execute the test
574 */
575 void ExecuteTest();
576
577 uint32_t m_cWnd; //!< cWnd
578 uint32_t m_segmentSize; //!< segment size
579 uint32_t m_segmentsAcked; //!< segments acked
580 uint32_t m_ssThresh; //!< ss thresh
581 Time m_rtt; //!< rtt
583 SequenceNumber32 m_lastAckedSeq; //!< last acked seq
585};
586
589 uint32_t ssThresh,
590 uint32_t segmentsAcked,
591 SequenceNumber32 highTxMark,
592 SequenceNumber32 lastAckedSeq,
593 Time rtt,
594 const std::string& name)
595 : TestCase(name),
596 m_cWnd(cWnd),
597 m_segmentSize(segmentSize),
598 m_segmentsAcked(segmentsAcked),
599 m_ssThresh(ssThresh),
600 m_rtt(rtt),
601 m_highTxMark(highTxMark),
602 m_lastAckedSeq(lastAckedSeq)
603{
604}
605
606void
613
614void
616{
618 m_state->m_cWnd = m_cWnd;
619 m_state->m_ssThresh = m_ssThresh;
620 m_state->m_segmentSize = m_segmentSize;
621 m_state->m_highTxMark = m_highTxMark;
622 m_state->m_lastAckedSeq = m_lastAckedSeq;
623
625 state->m_cWnd = m_cWnd;
626 state->m_ssThresh = m_ssThresh;
627 state->m_segmentSize = m_segmentSize;
628 state->m_highTxMark = m_highTxMark;
629 state->m_lastAckedSeq = m_lastAckedSeq;
630
632 cong->IncreaseWindow(m_state, m_segmentsAcked);
633
635 LinuxRenoCong->IncreaseWindow(state, m_segmentsAcked);
636
637 NS_TEST_ASSERT_MSG_EQ(m_state->m_cWnd.Get(),
638 state->m_cWnd.Get(),
639 "cWnd has not updated correctly");
640}
641
642/**
643 * \ingroup internet-test
644 *
645 * \brief TCP DCTCP TestSuite
646 */
648{
649 public:
651 : TestSuite("tcp-dctcp-test", Type::UNIT)
652 {
653 AddTestCase(new TcpDctcpToLinuxReno(2 * 1446,
654 1446,
655 4 * 1446,
656 2,
657 SequenceNumber32(4753),
658 SequenceNumber32(3216),
659 MilliSeconds(100),
660 "DCTCP falls to New Reno for slowstart"),
661 TestCase::Duration::QUICK);
663 "ECT Test : Check if ECT is set on Syn, Syn+Ack, "
664 "Ack and Data packets for DCTCP packets"),
665 TestCase::Duration::QUICK);
667 2,
668 "ECT Test : Check if ECT is not set on Syn, Syn+Ack and Ack but set on "
669 "Data packets for non-DCTCP but ECN enabled traffic"),
670 TestCase::Duration::QUICK);
672 "ECE Functionality Test: ECE should only be sent by "
673 "receiver when it receives CE flags"),
674 TestCase::Duration::QUICK);
675 }
676};
677
678static TcpDctcpTestSuite g_tcpdctcpTest; //!< static var for test initialization
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
void Cancel()
This method is syntactic sugar for the ns3::Simulator::Cancel method.
Definition event-id.cc:44
bool IsExpired() const
This method is syntactic sugar for the ns3::Simulator::IsExpired method.
Definition event-id.cc:58
Ipv4Address GetLocalAddress() const
Get the local address.
uint16_t GetPeerPort() const
Get the peer port.
uint16_t GetLocalPort() const
Get the local port.
Ipv4Address GetPeerAddress() const
Get the peer address.
uint16_t GetLocalPort() const
Get the local port.
Ipv6Address GetPeerAddress() const
Get the peer address.
Ipv6Address GetLocalAddress() const
Get the local address.
uint16_t GetPeerPort() const
Get the peer port.
friend Ptr< T > CopyObject(Ptr< T > object)
Copy an Object.
Definition object.h:581
Smart pointer class similar to boost::intrusive_ptr.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition simulator.h:560
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition simulator.cc:131
static Time Now()
Return the current simulation virtual time.
Definition simulator.cc:197
static void Run()
Run the simulation.
Definition simulator.cc:167
static EventId ScheduleNow(FUNC f, Ts &&... args)
Schedule an event to expire Now.
Definition simulator.h:594
bool IsManualIpTtl() const
Checks if the socket has a specific IPv4 TTL set.
Definition socket.cc:363
virtual uint8_t GetIpTtl() const
Query the value of IP Time to Live field of this socket.
Definition socket.cc:506
uint8_t GetIpTos() const
Query the value of IP Type of Service of this socket.
Definition socket.cc:439
Ptr< NetDevice > m_boundnetdevice
the device this socket is bound to (might be null).
Definition socket.h:1070
virtual uint8_t GetIpv6HopLimit() const
Query the value of IP Hop Limit field of this socket.
Definition socket.cc:531
void NotifyDataSent(uint32_t size)
Notify through the callback (if set) that some data have been sent.
Definition socket.cc:271
uint8_t GetPriority() const
Query the priority value of this socket.
Definition socket.cc:382
uint8_t GetIpv6Tclass() const
Query the value of IPv6 Traffic Class field of this socket.
Definition socket.cc:481
bool IsManualIpv6HopLimit() const
Checks if the socket has a specific IPv6 Hop Limit set.
Definition socket.cc:369
bool IsManualIpv6Tclass() const
Checks if the socket has a specific IPv6 Tclass set.
Definition socket.cc:357
indicates whether the socket has IP_TOS set.
Definition socket.h:1260
void SetTos(uint8_t tos)
Set the tag's TOS.
Definition socket.cc:787
uint8_t GetTos() const
Get the tag's TOS.
Definition socket.cc:793
This class implements a tag that carries the socket-specific TTL of a packet to the IP layer.
Definition socket.h:1113
void SetTtl(uint8_t ttl)
Set the tag's TTL.
Definition socket.cc:593
This class implements a tag that carries the socket-specific HOPLIMIT of a packet to the IPv6 layer.
Definition socket.h:1161
void SetHopLimit(uint8_t hopLimit)
Set the tag's Hop Limit.
Definition socket.cc:657
indicates whether the socket has IPV6_TCLASS set.
Definition socket.h:1355
void SetTclass(uint8_t tclass)
Set the tag's Tclass.
Definition socket.cc:899
indicates whether the socket has a priority set.
Definition socket.h:1307
void SetPriority(uint8_t priority)
Set the tag's priority.
Definition socket.cc:843
static TypeId GetTypeId()
Get the type ID.
Definition tcp-dctcp.cc:25
General infrastructure for TCP testing.
virtual Ptr< TcpSocketMsgBase > CreateSenderSocket(Ptr< Node > node)
Create and install the socket to install on the sender.
SocketWho
Used as parameter of methods, specifies on what node the caller is interested (e.g.
@ RECEIVER
Receiver node.
virtual Ptr< TcpSocketMsgBase > CreateReceiverSocket(Ptr< Node > node)
Create and install the socket to install on the receiver.
virtual Ptr< TcpSocketMsgBase > CreateSocket(Ptr< Node > node, TypeId socketType, TypeId congControl)
Create a socket.
virtual void ConfigureProperties()
Change the configuration of the socket properties.
void SetUseEcn(SocketWho who, TcpSocketState::UseEcn_t useEcn)
Forcefully set the ECN mode of use.
virtual void ConfigureEnvironment()
Change the configuration of the environment.
Header for the Transmission Control Protocol.
Definition tcp-header.h:36
void SetDestinationPort(uint16_t port)
Set the destination port.
Definition tcp-header.cc:59
void SetSequenceNumber(SequenceNumber32 sequenceNumber)
Set the sequence Number.
Definition tcp-header.cc:65
void SetFlags(uint8_t flags)
Set flags of the header.
Definition tcp-header.cc:77
void SetWindowSize(uint16_t windowSize)
Set the window size.
Definition tcp-header.cc:83
void SetSourcePort(uint16_t port)
Set the source port.
Definition tcp-header.cc:53
void SetAckNumber(SequenceNumber32 ackNumber)
Set the ACK number.
Definition tcp-header.cc:71
uint8_t GetFlags() const
Get the flags.
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.
virtual void ReTxTimeout()
An RTO event happened.
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.
static TypeId GetTypeId()
Get the type ID.
static const char *const TcpCongStateName[TcpSocketState::CA_LAST_STATE]
Literal names of TCP states for use in log messages.
@ CA_CWR
cWnd was reduced due to some congestion notification event, such as ECN, ICMP source quench,...
@ CA_OPEN
Normal state, no dubious events.
@ ECN_CWR_SENT
Sender has reduced the congestion window, and sent a packet with CWR bit set in TCP header.
@ ECN_DISABLED
ECN disabled traffic.
@ ECN_ECE_RCVD
Last ACK received had ECE bit set in TCP header.
static const char *const EcnStateName[TcpSocketState::ECN_CWR_SENT+1]
Literal names of ECN states for use in log messages.
encapsulates test code
Definition test.h:1050
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Definition test.cc:292
A suite of tests to run.
Definition test.h:1267
Type
Type of test.
Definition test.h:1274
static constexpr auto UNIT
Definition test.h:1291
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
Definition nstime.h:392
T Get() const
Get the underlying value.
a unique identifier for an interface.
Definition type-id.h:48
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
uint32_t segmentSize
void SetDefault(std::string name, const AttributeValue &value)
Definition config.cc:883
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition log.h:257
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition log.h:271
#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:264
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Definition object.h:619
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition object-base.h:35
SequenceNumber< uint32_t, int32_t > SequenceNumber32
32 bit Sequence number.
@ ESTABLISHED
Connection established
Definition tcp-socket.h:61
@ 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:62
@ FIN_WAIT_1
Our side has shutdown, waiting to complete transmission of remaining buffered data
Definition tcp-socket.h:68
@ LAST_ACK
Our side has shutdown after remote has shutdown.
Definition tcp-socket.h:65
#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:134
#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:554
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition nstime.h:1308
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition nstime.h:1320
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.
Definition ptr.h:580
static TcpDctcpTestSuite g_tcpdctcpTest
static var for test initialization