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 * 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
46{
47 public:
54 TcpDctcpCodePointsTest(uint8_t testCase, const std::string& desc);
55
56 protected:
57 void Tx(const Ptr<const Packet> p, const TcpHeader& h, SocketWho who) override;
58 void Rx(const Ptr<const Packet> p, const TcpHeader& h, SocketWho who) override;
61 void ConfigureProperties() override;
62 void ConfigureEnvironment() override;
63
64 private:
68 uint8_t m_testCase;
69};
70
71TcpDctcpCodePointsTest::TcpDctcpCodePointsTest(uint8_t testCase, const std::string& desc)
72 : TcpGeneralTest(desc),
73 m_senderSent(0),
74 m_receiverSent(0),
75 m_senderReceived(0),
76 m_testCase(testCase)
77{
78}
79
80void
82{
83 bool foundTag = false; // IpTosTag will only be found if ECN bits are set
84 if (who == SENDER && (m_testCase == 1 || m_testCase == 2))
85 {
87 SocketIpTosTag ipTosTag;
88 foundTag = p->PeekPacketTag(ipTosTag);
89 if (m_testCase == 1)
90 {
91 if (m_senderSent == 1)
92 {
93 NS_TEST_ASSERT_MSG_EQ(foundTag, true, "Tag not found");
94 NS_TEST_ASSERT_MSG_EQ(unsigned(ipTosTag.GetTos()),
95 0x1,
96 "IP TOS should have ECT1 for SYN packet for DCTCP traffic");
97 }
98 if (m_senderSent == 3)
99 {
100 NS_TEST_ASSERT_MSG_EQ(foundTag, true, "Tag not found");
101 NS_TEST_ASSERT_MSG_EQ(unsigned(ipTosTag.GetTos()),
102 0x1,
103 "IP TOS should have ECT1 for data packets for DCTCP traffic");
104 }
105 }
106 else
107 {
108 if (m_senderSent == 1)
109 {
111 foundTag,
112 false,
113 "IP TOS should not have ECT1 for SYN packet for DCTCP traffic");
114 }
115 if (m_senderSent == 3)
116 {
117 NS_TEST_ASSERT_MSG_EQ(foundTag, true, "Tag not found");
118 NS_TEST_ASSERT_MSG_EQ(unsigned(ipTosTag.GetTos()),
119 0x2,
120 "IP TOS should have ECT0 for data packets for non-DCTCP but "
121 "ECN enabled traffic");
122 }
123 }
124 }
125 else if (who == RECEIVER && (m_testCase == 1 || m_testCase == 2))
126 {
128 SocketIpTosTag ipTosTag;
129 foundTag = p->PeekPacketTag(ipTosTag);
130 if (m_testCase == 1)
131 {
132 if (m_receiverSent == 1)
133 {
134 NS_TEST_ASSERT_MSG_EQ(foundTag, true, "Tag not found");
136 unsigned(ipTosTag.GetTos()),
137 0x1,
138 "IP TOS should have ECT1 for SYN+ACK packet for DCTCP traffic");
139 }
140 if (m_receiverSent == 2)
141 {
142 NS_TEST_ASSERT_MSG_EQ(foundTag, true, "Tag not found");
144 unsigned(ipTosTag.GetTos()),
145 0x1,
146 "IP TOS should have ECT1 for pure ACK packets for DCTCP traffic");
147 }
148 }
149 else
150 {
151 if (m_receiverSent == 1)
152 {
153 NS_TEST_ASSERT_MSG_EQ(foundTag,
154 false,
155 "IP TOS should have neither ECT0 nor ECT1 for SYN+ACK packet "
156 "for non-DCTCP traffic");
157 }
158 if (m_receiverSent == 2)
159 {
160 NS_TEST_ASSERT_MSG_EQ(foundTag,
161 false,
162 "IP TOS should not have ECT1 for pure ACK packets for "
163 "non-DCTCP traffic but ECN enabled traffic");
164 }
165 }
166 }
167}
168
169void
171{
172 if (who == SENDER && m_testCase == 3)
173 {
175 if (m_senderReceived == 2 && m_testCase == 3)
176 {
178 ((h.GetFlags()) & TcpHeader::ECE),
179 0,
180 "The flag ECE should be set in TCP header of the packet sent by the receiver when "
181 "it receives a packet with CE bit set in IP header");
182 }
183 if (m_senderReceived > 2 && m_testCase == 3)
184 {
186 0,
187 "The flag ECE should be not be set in TCP header of the packet "
188 "sent by the receiver if it receives a packet without CE bit set "
189 "in IP header in spite of Sender not sending CWR flags to it");
190 }
191 }
192}
193
194void
196{
200}
201
202void
204{
206 Config::SetDefault("ns3::TcpDctcp::UseEct0", BooleanValue(false));
207}
208
220{
221 public:
226 static TypeId GetTypeId();
227
229 uint8_t m_testCase;
230
233 {
235 }
236
242 : TcpSocketMsgBase(other)
243 {
244 }
245
250 void SetTestCase(uint8_t testCase);
251
252 protected:
253 uint32_t SendDataPacket(SequenceNumber32 seq, uint32_t maxSize, bool withAck) override;
254 void ReTxTimeout() override;
255 Ptr<TcpSocketBase> Fork() override;
256};
257
259
260TypeId
262{
263 static TypeId tid = TypeId("ns3::TcpDctcpCongestedRouter")
265 .SetGroupName("Internet")
266 .AddConstructor<TcpDctcpCongestedRouter>();
267 return tid;
268}
269
270void
272{
274}
275
276void
278{
279 m_testCase = testCase;
280}
281
284{
285 NS_LOG_FUNCTION(this << seq << maxSize << withAck);
287
288 bool isRetransmission = false;
289 if (seq != m_tcb->m_highTxMark)
290 {
291 isRetransmission = true;
292 }
293
294 Ptr<Packet> p = m_txBuffer->CopyFromSequence(maxSize, seq)->GetPacketCopy();
295 uint32_t sz = p->GetSize(); // Size of packet
296 uint8_t flags = withAck ? TcpHeader::ACK : 0;
297 uint32_t remainingData = m_txBuffer->SizeFromSequence(seq + SequenceNumber32(sz));
298
299 if (withAck)
300 {
302 m_delAckCount = 0;
303 }
304
305 // For test 3, we don't send CWR flags on receipt of ECE to check if Receiver sends ECE only
306 // when there is CE flags
308 m_ecnEchoSeq.Get() > m_ecnCWRSeq.Get() && !isRetransmission && m_testCase != 3)
309 {
310 NS_LOG_INFO("Backoff mechanism by reducing CWND by half because we've received ECN Echo");
312 flags |= TcpHeader::CWR;
313 m_ecnCWRSeq = seq;
316 NS_LOG_INFO("CWR flags set");
319 {
322 }
323 }
324 /*
325 * Add tags for each socket option.
326 * Note that currently the socket adds both IPv4 tag and IPv6 tag
327 * if both options are set. Once the packet got to layer three, only
328 * the corresponding tags will be read.
329 */
330 if (GetIpTos())
331 {
332 SocketIpTosTag ipTosTag;
333
334 NS_LOG_LOGIC(" ECT bits should not be set on retransmitted packets ");
335 if (m_testCase == 3 && m_dataPacketSent == 1 && !isRetransmission)
336 {
337 ipTosTag.SetTos(GetIpTos() | 0x3);
338 }
339 else
340 {
341 if (m_tcb->m_ecnState != TcpSocketState::ECN_DISABLED && (GetIpTos() & 0x3) == 0 &&
342 !isRetransmission)
343 {
344 ipTosTag.SetTos(GetIpTos() | 0x1);
345 }
346 else
347 {
348 ipTosTag.SetTos(GetIpTos());
349 }
350 }
351 p->AddPacketTag(ipTosTag);
352 }
353 else
354 {
355 SocketIpTosTag ipTosTag;
356 if (m_testCase == 3 && m_dataPacketSent == 1 && !isRetransmission)
357 {
358 ipTosTag.SetTos(0x3);
359 }
360 else
361 {
362 if (m_tcb->m_ecnState != TcpSocketState::ECN_DISABLED && !isRetransmission)
363 {
364 ipTosTag.SetTos(0x1);
365 }
366 }
367 p->AddPacketTag(ipTosTag);
368 }
369
370 if (IsManualIpv6Tclass())
371 {
372 SocketIpv6TclassTag ipTclassTag;
373 if (m_testCase == 3 && m_dataPacketSent == 1 && !isRetransmission)
374 {
375 ipTclassTag.SetTclass(GetIpv6Tclass() | 0x3);
376 }
377 else
378 {
380 !isRetransmission)
381 {
382 ipTclassTag.SetTclass(GetIpv6Tclass() | 0x1);
383 }
384 else
385 {
386 ipTclassTag.SetTclass(GetIpv6Tclass());
387 }
388 }
389 p->AddPacketTag(ipTclassTag);
390 }
391 else
392 {
393 SocketIpv6TclassTag ipTclassTag;
394 if (m_testCase == 3 && m_dataPacketSent == 1 && !isRetransmission)
395 {
396 ipTclassTag.SetTclass(0x3);
397 }
398 else
399 {
400 if (m_tcb->m_ecnState != TcpSocketState::ECN_DISABLED && !isRetransmission)
401 {
402 ipTclassTag.SetTclass(0x1);
403 }
404 }
405 p->AddPacketTag(ipTclassTag);
406 }
407
408 if (IsManualIpTtl())
409 {
410 SocketIpTtlTag ipTtlTag;
411 ipTtlTag.SetTtl(GetIpTtl());
412 p->AddPacketTag(ipTtlTag);
413 }
414
416 {
417 SocketIpv6HopLimitTag ipHopLimitTag;
418 ipHopLimitTag.SetHopLimit(GetIpv6HopLimit());
419 p->AddPacketTag(ipHopLimitTag);
420 }
421
422 uint8_t priority = GetPriority();
423 if (priority)
424 {
425 SocketPriorityTag priorityTag;
426 priorityTag.SetPriority(priority);
427 p->ReplacePacketTag(priorityTag);
428 }
429
430 if (m_closeOnEmpty && (remainingData == 0))
431 {
432 flags |= TcpHeader::FIN;
433 if (m_state == ESTABLISHED)
434 { // On active close: I am the first one to send FIN
435 NS_LOG_DEBUG("ESTABLISHED -> FIN_WAIT_1");
437 }
438 else if (m_state == CLOSE_WAIT)
439 { // On passive close: Peer sent me FIN already
440 NS_LOG_DEBUG("CLOSE_WAIT -> LAST_ACK");
442 }
443 }
444 TcpHeader header;
445 header.SetFlags(flags);
446 header.SetSequenceNumber(seq);
447 header.SetAckNumber(m_tcb->m_rxBuffer->NextRxSequence());
448 if (m_endPoint)
449 {
452 }
453 else
454 {
457 }
459 AddOptions(header);
460
462 {
463 // Schedules retransmit timeout. m_rto should be already doubled.
464
465 NS_LOG_LOGIC(this << " SendDataPacket Schedule ReTxTimeout at time "
466 << Simulator::Now().GetSeconds() << " to expire at time "
467 << (Simulator::Now() + m_rto.Get()).GetSeconds());
469 }
470
471 m_txTrace(p, header, this);
472
473 if (m_endPoint)
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_endPoint->GetPeerAddress() << ". Header " << header);
483 }
484 else
485 {
486 m_tcp->SendPacket(p,
487 header,
491 NS_LOG_DEBUG("Send segment of size "
492 << sz << " with remaining data " << remainingData << " via TcpL4Protocol to "
493 << m_endPoint6->GetPeerAddress() << ". Header " << header);
494 }
495
496 UpdateRttHistory(seq, sz, isRetransmission);
497
498 // Notify the application of the data being sent unless this is a retransmit
499 if (seq + sz > m_tcb->m_highTxMark)
500 {
502 this,
503 (seq + sz - m_tcb->m_highTxMark.Get()));
504 }
505 // Update highTxMark
506 m_tcb->m_highTxMark = std::max(seq + sz, m_tcb->m_highTxMark.Get());
507 return sz;
508}
509
512{
513 return CopyObject<TcpDctcpCongestedRouter>(this);
514}
515
518{
519 if (m_testCase == 2)
520 {
522 }
523 else if (m_testCase == 3)
524 {
525 Ptr<TcpDctcpCongestedRouter> socket = DynamicCast<TcpDctcpCongestedRouter>(
527 socket->SetTestCase(m_testCase);
528 return socket;
529 }
530 else
531 {
535 }
536}
537
540{
541 if (m_testCase == 2)
542 {
544 }
545 else
546 {
550 }
551}
552
559{
560 public:
575 uint32_t ssThresh,
576 uint32_t segmentsAcked,
577 SequenceNumber32 highTxMark,
578 SequenceNumber32 lastAckedSeq,
579 Time rtt,
580 const std::string& name);
581
582 private:
583 void DoRun() override;
586 void ExecuteTest();
587
596};
597
600 uint32_t ssThresh,
601 uint32_t segmentsAcked,
602 SequenceNumber32 highTxMark,
603 SequenceNumber32 lastAckedSeq,
604 Time rtt,
605 const std::string& name)
606 : TestCase(name),
607 m_cWnd(cWnd),
608 m_segmentSize(segmentSize),
609 m_segmentsAcked(segmentsAcked),
610 m_ssThresh(ssThresh),
611 m_rtt(rtt),
612 m_highTxMark(highTxMark),
613 m_lastAckedSeq(lastAckedSeq)
614{
615}
616
617void
619{
623}
624
625void
627{
628 m_state = CreateObject<TcpSocketState>();
634
635 Ptr<TcpSocketState> state = CreateObject<TcpSocketState>();
636 state->m_cWnd = m_cWnd;
637 state->m_ssThresh = m_ssThresh;
638 state->m_segmentSize = m_segmentSize;
639 state->m_highTxMark = m_highTxMark;
640 state->m_lastAckedSeq = m_lastAckedSeq;
641
642 Ptr<TcpDctcp> cong = CreateObject<TcpDctcp>();
643 cong->IncreaseWindow(m_state, m_segmentsAcked);
644
645 Ptr<TcpLinuxReno> LinuxRenoCong = CreateObject<TcpLinuxReno>();
646 LinuxRenoCong->IncreaseWindow(state, m_segmentsAcked);
647
649 state->m_cWnd.Get(),
650 "cWnd has not updated correctly");
651}
652
659{
660 public:
662 : TestSuite("tcp-dctcp-test", UNIT)
663 {
664 AddTestCase(new TcpDctcpToLinuxReno(2 * 1446,
665 1446,
666 4 * 1446,
667 2,
668 SequenceNumber32(4753),
669 SequenceNumber32(3216),
670 MilliSeconds(100),
671 "DCTCP falls to New Reno for slowstart"),
674 "ECT Test : Check if ECT is set on Syn, Syn+Ack, "
675 "Ack and Data packets for DCTCP packets"),
678 2,
679 "ECT Test : Check if ECT is not set on Syn, Syn+Ack and Ack but set on "
680 "Data packets for non-DCTCP but ECN enabled traffic"),
683 "ECE Functionality Test: ECE should only be sent by "
684 "receiver when it receives CE flags"),
686 }
687};
688
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 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.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:568
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition: simulator.cc:140
static Time Now()
Return the current simulation virtual time.
Definition: simulator.cc:199
static void Run()
Run the simulation.
Definition: simulator.cc:176
static EventId ScheduleNow(FUNC f, Ts &&... args)
Schedule an event to expire Now.
Definition: simulator.h:606
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
static TypeId GetTypeId()
Get the type ID.
Definition: tcp-dctcp.cc:36
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: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.
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.
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.
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.
SequenceNumber32 m_lastAckedSeq
Last sequence ACKed.
TracedValue< uint32_t > m_cWnd
Congestion window.
@ 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.
Ptr< TcpRxBuffer > m_rxBuffer
Rx buffer (reordering buffer)
static const char *const EcnStateName[TcpSocketState::ECN_CWR_SENT+1]
Literal names of ECN states for use in log messages.
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
@ QUICK
Fast test.
Definition: test.h:1065
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:301
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:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:936
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:46
SequenceNumber< uint32_t, int32_t > SequenceNumber32
32 bit Sequence number.
@ 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:1336
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1348
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static TcpDctcpTestSuite g_tcpdctcpTest
static var for test initialization