A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
tcp-ecn-test.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016 NITK Surathkal
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Authors: Shravya Ks <shravya.ks0@gmail.com>
7 *
8 */
9#include "tcp-error-model.h"
10#include "tcp-general-test.h"
11
12#include "ns3/ipv4-end-point.h"
13#include "ns3/ipv4-interface-address.h"
14#include "ns3/ipv4-route.h"
15#include "ns3/ipv4-routing-protocol.h"
16#include "ns3/ipv4.h"
17#include "ns3/ipv6-end-point.h"
18#include "ns3/ipv6-route.h"
19#include "ns3/ipv6-routing-protocol.h"
20#include "ns3/ipv6.h"
21#include "ns3/log.h"
22#include "ns3/node.h"
23#include "ns3/tcp-l4-protocol.h"
24#include "ns3/tcp-rx-buffer.h"
25#include "ns3/tcp-tx-buffer.h"
26
27namespace ns3
28{
29
30NS_LOG_COMPONENT_DEFINE("TcpEcnTestSuite");
31
32/**
33 * \ingroup internet-test
34 *
35 * \brief checks if ECT, CWR and ECE bits are set correctly in different scenarios
36 *
37 * This test suite will run four combinations of enabling ECN (sender off and receiver off; sender
38 * on and receiver off; sender off and receiver on; sender on and receiver on;) and checks that the
39 * TOS byte of eventual packets transmitted or received have ECT, CWR, and ECE set correctly (or
40 * not). It also checks if congestion window is being reduced by half only once per every window on
41 * receipt of ECE flags
42 *
43 */
45{
46 public:
47 /**
48 * \brief Constructor
49 *
50 * \param testcase test case number
51 * \param desc Description about the ECN capabilities of sender and receiver
52 */
53 TcpEcnTest(uint32_t testcase, const std::string& desc);
54
55 protected:
56 void CWndTrace(uint32_t oldValue, uint32_t newValue) override;
57 void Rx(const Ptr<const Packet> p, const TcpHeader& h, SocketWho who) override;
58 void Tx(const Ptr<const Packet> p, const TcpHeader& h, SocketWho who) override;
60 void ConfigureProperties() override;
61
62 private:
63 uint32_t m_cwndChangeCount; //!< Number of times the congestion window did change
64 uint32_t m_senderSent; //!< Number of segments sent by the sender
65 uint32_t m_senderReceived; //!< Number of segments received by the sender
66 uint32_t m_receiverReceived; //!< Number of segments received by the receiver
67 uint32_t m_testcase; //!< Test case type
68};
69
70/**
71 * \ingroup internet-test
72 *
73 * \brief A TCP socket which sends certain data packets with CE flags set for tests 5 and 6.
74 *
75 * The SendDataPacket function of this class sends data packets numbered 1 and 3 with CE flags set
76 * for test 5 to verify if ECE and CWR bits are correctly set by receiver and sender respectively.
77 * It also sets CE flags on data packets 4 and 5 in test case 6 to check if sender reduces
78 * congestion window appropriately and also only once per every window.
79 *
80 */
82{
83 public:
84 /**
85 * \brief Get the type ID.
86 * \return the object TypeId
87 */
88 static TypeId GetTypeId();
89
90 uint32_t m_dataPacketSent; //!< Number of packets sent
91 uint8_t m_testcase; //!< Test case type
92
98
99 /**
100 * \brief Constructor.
101 * \param other The object to copy from.
102 */
107
108 /**
109 * Set the test case type
110 * \param testCase Test case type
111 */
112 void SetTestCase(uint8_t testCase);
113
114 protected:
115 uint32_t SendDataPacket(SequenceNumber32 seq, uint32_t maxSize, bool withAck) override;
116 void ReTxTimeout() override;
117 Ptr<TcpSocketBase> Fork() override;
118};
119
120NS_OBJECT_ENSURE_REGISTERED(TcpSocketCongestedRouter);
121
122TypeId
124{
125 static TypeId tid = TypeId("ns3::TcpSocketCongestedRouter")
127 .SetGroupName("Internet")
128 .AddConstructor<TcpSocketCongestedRouter>();
129 return tid;
130}
131
132void
137
138void
140{
141 m_testcase = testCase;
142}
143
146{
147 NS_LOG_FUNCTION(this << seq << maxSize << withAck);
149
150 bool isRetransmission = false;
151 if (seq != m_tcb->m_highTxMark)
152 {
153 isRetransmission = true;
154 }
155
156 Ptr<Packet> p = m_txBuffer->CopyFromSequence(maxSize, seq)->GetPacketCopy();
157 uint32_t sz = p->GetSize(); // Size of packet
158 uint8_t flags = withAck ? TcpHeader::ACK : 0;
159 uint32_t remainingData = m_txBuffer->SizeFromSequence(seq + SequenceNumber32(sz));
160
161 if (withAck)
162 {
164 m_delAckCount = 0;
165 }
166
167 // Sender should reduce the Congestion Window as a response to receiver's ECN Echo notification
168 // only once per window
169 if (m_tcb->m_ecnState == TcpSocketState::ECN_ECE_RCVD &&
170 m_ecnEchoSeq.Get() > m_ecnCWRSeq.Get() && !isRetransmission)
171 {
172 NS_LOG_DEBUG(TcpSocketState::EcnStateName[m_tcb->m_ecnState] << " -> ECN_CWR_SENT");
174 m_ecnCWRSeq = seq;
175 flags |= TcpHeader::CWR;
176 NS_LOG_INFO("CWR flags set");
177 }
178 /*
179 * Add tags for each socket option.
180 * Note that currently the socket adds both IPv4 tag and IPv6 tag
181 * if both options are set. Once the packet got to layer three, only
182 * the corresponding tags will be read.
183 */
184 if (GetIpTos())
185 {
186 SocketIpTosTag ipTosTag;
187 if ((m_testcase == 5 && (m_dataPacketSent == 1 || m_dataPacketSent == 3)) ||
188 (m_testcase == 6 && (m_dataPacketSent == 4 || m_dataPacketSent == 5)))
189 {
190 ipTosTag.SetTos(MarkEcnCe(GetIpTos()));
191 }
192 else
193 {
194 if (m_tcb->m_ecnState != TcpSocketState::ECN_DISABLED && (GetIpTos() & 0x3) == 0)
195 {
196 ipTosTag.SetTos(MarkEcnEct0(GetIpTos()));
197 }
198 else
199 {
200 ipTosTag.SetTos(GetIpTos());
201 }
202 }
203 p->AddPacketTag(ipTosTag);
204 }
205 else
206 {
207 SocketIpTosTag ipTosTag;
208 if ((m_testcase == 5 && (m_dataPacketSent == 1 || m_dataPacketSent == 3)) ||
209 (m_testcase == 6 && (m_dataPacketSent == 4 || m_dataPacketSent == 5)))
210 {
211 ipTosTag.SetTos(MarkEcnCe(GetIpTos()));
212 }
213 else
214 {
215 if (m_tcb->m_ecnState != TcpSocketState::ECN_DISABLED)
216 {
217 ipTosTag.SetTos(MarkEcnEct0(GetIpTos()));
218 }
219 }
220 p->AddPacketTag(ipTosTag);
221 }
222
223 if (IsManualIpv6Tclass())
224 {
225 SocketIpv6TclassTag ipTclassTag;
226 if ((m_testcase == 5 && (m_dataPacketSent == 1 || m_dataPacketSent == 3)) ||
227 (m_testcase == 6 && (m_dataPacketSent == 4 || m_dataPacketSent == 5)))
228 {
229 ipTclassTag.SetTclass(MarkEcnCe(GetIpv6Tclass()));
230 }
231 else
232 {
233 if (m_tcb->m_ecnState != TcpSocketState::ECN_DISABLED && (GetIpv6Tclass() & 0x3) == 0)
234 {
235 ipTclassTag.SetTclass(MarkEcnEct0(GetIpv6Tclass()));
236 }
237 else
238 {
239 ipTclassTag.SetTclass(GetIpv6Tclass());
240 }
241 }
242 p->AddPacketTag(ipTclassTag);
243 }
244 else
245 {
246 SocketIpv6TclassTag ipTclassTag;
247 if ((m_testcase == 5 && (m_dataPacketSent == 1 || m_dataPacketSent == 3)) ||
248 (m_testcase == 6 && (m_dataPacketSent == 4 || m_dataPacketSent == 5)))
249 {
250 ipTclassTag.SetTclass(MarkEcnCe(GetIpv6Tclass()));
251 }
252 else
253 {
254 if (m_tcb->m_ecnState != TcpSocketState::ECN_DISABLED)
255 {
256 ipTclassTag.SetTclass(MarkEcnEct0(GetIpv6Tclass()));
257 }
258 }
259 p->AddPacketTag(ipTclassTag);
260 }
261
262 if (IsManualIpTtl())
263 {
264 SocketIpTtlTag ipTtlTag;
265 ipTtlTag.SetTtl(GetIpTtl());
266 p->AddPacketTag(ipTtlTag);
267 }
268
270 {
271 SocketIpv6HopLimitTag ipHopLimitTag;
272 ipHopLimitTag.SetHopLimit(GetIpv6HopLimit());
273 p->AddPacketTag(ipHopLimitTag);
274 }
275
276 uint8_t priority = GetPriority();
277 if (priority)
278 {
279 SocketPriorityTag priorityTag;
280 priorityTag.SetPriority(priority);
281 p->ReplacePacketTag(priorityTag);
282 }
283
284 if (m_closeOnEmpty && (remainingData == 0))
285 {
286 flags |= TcpHeader::FIN;
287 if (m_state == ESTABLISHED)
288 { // On active close: I am the first one to send FIN
289 NS_LOG_DEBUG("ESTABLISHED -> FIN_WAIT_1");
291 }
292 else if (m_state == CLOSE_WAIT)
293 { // On passive close: Peer sent me FIN already
294 NS_LOG_DEBUG("CLOSE_WAIT -> LAST_ACK");
296 }
297 }
298 TcpHeader header;
299 header.SetFlags(flags);
300 header.SetSequenceNumber(seq);
301 header.SetAckNumber(m_tcb->m_rxBuffer->NextRxSequence());
302 if (m_endPoint)
303 {
306 }
307 else
308 {
311 }
313 AddOptions(header);
314
316 {
317 // Schedules retransmit timeout. m_rto should be already doubled.
318
319 NS_LOG_LOGIC(this << " SendDataPacket Schedule ReTxTimeout at time "
320 << Simulator::Now().GetSeconds() << " to expire at time "
321 << (Simulator::Now() + m_rto.Get()).GetSeconds());
323 }
324
325 m_txTrace(p, header, this);
326
327 if (m_endPoint)
328 {
329 m_tcp->SendPacket(p,
330 header,
334 NS_LOG_DEBUG("Send segment of size "
335 << sz << " with remaining data " << remainingData << " via TcpL4Protocol to "
336 << m_endPoint->GetPeerAddress() << ". Header " << header);
337 }
338 else
339 {
340 m_tcp->SendPacket(p,
341 header,
345 NS_LOG_DEBUG("Send segment of size "
346 << sz << " with remaining data " << remainingData << " via TcpL4Protocol to "
347 << m_endPoint6->GetPeerAddress() << ". Header " << header);
348 }
349
350 UpdateRttHistory(seq, sz, isRetransmission);
351
352 // Notify the application of the data being sent unless this is a retransmit
353 if (seq + sz > m_tcb->m_highTxMark)
354 {
356 this,
357 (seq + sz - m_tcb->m_highTxMark.Get()));
358 }
359 // Update highTxMark
360 m_tcb->m_highTxMark = std::max(seq + sz, m_tcb->m_highTxMark.Get());
361 return sz;
362}
363
369
370TcpEcnTest::TcpEcnTest(uint32_t testcase, const std::string& desc)
371 : TcpGeneralTest(desc),
372 m_cwndChangeCount(0),
373 m_senderSent(0),
374 m_senderReceived(0),
375 m_receiverReceived(0),
376 m_testcase(testcase)
377{
378}
379
380void
382{
384 if (m_testcase == 2 || m_testcase == 4 || m_testcase == 5 || m_testcase == 6)
385 {
387 }
388 if (m_testcase == 3 || m_testcase == 4 || m_testcase == 5 || m_testcase == 6)
389 {
391 }
392}
393
394void
396{
397 if (m_testcase == 6)
398 {
399 if (newValue < oldValue)
400 {
403 1,
404 "Congestion window should be reduced once per every window");
405 NS_TEST_ASSERT_MSG_EQ(newValue,
406 1000,
407 "Congestion window should not drop below 2 segments");
408 }
409 }
410}
411
412void
414{
415 if (who == RECEIVER)
416 {
417 if (m_receiverReceived == 0)
418 {
420 0,
421 "SYN should be received as first message at the receiver");
422 if (m_testcase == 2 || m_testcase == 4 || m_testcase == 5 || m_testcase == 6)
423 {
425 ((h.GetFlags()) & TcpHeader::ECE) && ((h.GetFlags()) & TcpHeader::CWR),
426 0,
427 "The flags ECE + CWR should be set in the TCP header of first message received "
428 "at receiver when sender is ECN Capable");
429 }
430 else
431 {
433 ((h.GetFlags()) & TcpHeader::ECE) && ((h.GetFlags()) & TcpHeader::CWR),
434 0,
435 "The flags ECE + CWR should not be set in the TCP header of first message "
436 "received at receiver when sender is not ECN Capable");
437 }
438 }
439 else if (m_receiverReceived == 1)
440 {
442 0,
443 "ACK should be received as second message at receiver");
444 }
445 else if (m_receiverReceived == 3 && m_testcase == 5)
446 {
448 0,
449 "Sender should send CWR on receipt of ECE");
450 }
452 }
453 else if (who == SENDER)
454 {
455 if (m_senderReceived == 0)
456 {
458 ((h.GetFlags()) & TcpHeader::ACK),
459 0,
460 "SYN+ACK received as first message at sender");
461 if (m_testcase == 4 || m_testcase == 5 || m_testcase == 6)
462 {
464 (h.GetFlags() & TcpHeader::ECE),
465 0,
466 "The flag ECE should be set in the TCP header of first message received at "
467 "sender when both receiver and sender are ECN Capable");
468 }
469 else
470 {
472 ((h.GetFlags()) & TcpHeader::ECE),
473 0,
474 "The flag ECE should not be set in the TCP header of first message received at "
475 "sender when either receiver or sender are not ECN Capable");
476 }
477 }
478 if (m_testcase == 5 && m_receiverReceived > 12)
479 {
481 0,
482 "The flag ECE should not be set in TCP header of the packet sent "
483 "by the receiver after sender sends CWR flags to receiver and "
484 "receiver receives a packet without CE bit set in IP header");
485 }
487 }
488}
489
490void
492{
493 if (who == SENDER)
494 {
495 m_senderSent++;
496 if (m_senderSent == 3)
497 {
498 SocketIpTosTag ipTosTag;
499 bool found = p->PeekPacketTag(ipTosTag);
500 uint16_t ipTos = 0;
501 if (found)
502 {
503 ipTos = static_cast<uint16_t>(ipTosTag.GetTos());
504 }
505 if (m_testcase == 4 || m_testcase == 6)
506 {
508 0x2,
509 "IP TOS should have ECT set if ECN negotiation between "
510 "endpoints is successful");
511 }
512 else if (m_testcase == 5)
513 {
514 if (m_senderSent == 3 || m_senderSent == 5)
515 {
517 ipTos,
518 0x3,
519 "IP TOS should have CE bit set for 3rd and 5th packet sent in test case 5");
520 }
521 else
522 {
524 0x2,
525 "IP TOS should have ECT set if ECN negotiation between "
526 "endpoints is successful");
527 }
528 }
529 else
530 {
532 0x2,
533 "IP TOS should not have ECT set if ECN negotiation between "
534 "endpoints is unsuccessful");
535 }
536 }
537 }
538}
539
542{
543 if (m_testcase == 5 || m_testcase == 6)
544 {
547 socket->SetTestCase(m_testcase);
548 return socket;
549 }
550 else
551 {
553 }
554}
555
556/**
557 * \ingroup internet-test
558 *
559 * \brief TCP ECN TestSuite
560 */
562{
563 public:
565 : TestSuite("tcp-ecn-test", Type::UNIT)
566 {
568 1,
569 "ECN Negotiation Test : ECN incapable sender and ECN incapable receiver"),
572 new TcpEcnTest(2,
573 "ECN Negotiation Test : ECN capable sender and ECN incapable receiver"),
576 new TcpEcnTest(3,
577 "ECN Negotiation Test : ECN incapable sender and ECN capable receiver"),
580 new TcpEcnTest(4, "ECN Negotiation Test : ECN capable sender and ECN capable receiver"),
583 new TcpEcnTest(
584 5,
585 "ECE and CWR Functionality Test: ECN capable sender and ECN capable receiver"),
588 new TcpEcnTest(
589 6,
590 "Congestion Window Reduction Test :ECN capable sender and ECN capable receiver"),
592 }
593};
594
595static TcpEcnTestSuite g_tcpECNTestSuite; //!< static var for test initialization
596
597} // namespace ns3
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 Time Now()
Return the current simulation virtual time.
Definition simulator.cc:197
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
checks if ECT, CWR and ECE bits are set correctly in different scenarios
void ConfigureProperties() override
Change the configuration of the socket properties.
uint32_t m_senderSent
Number of segments sent by the sender.
Ptr< TcpSocketMsgBase > CreateSenderSocket(Ptr< Node > node) override
Create and install the socket to install on the sender.
void CWndTrace(uint32_t oldValue, uint32_t newValue) override
Tracks the congestion window changes.
TcpEcnTest(uint32_t testcase, const std::string &desc)
Constructor.
uint32_t m_cwndChangeCount
Number of times the congestion window did change.
uint32_t m_senderReceived
Number of segments received by the sender.
uint32_t m_receiverReceived
Number of segments received by the receiver.
void Tx(const Ptr< const Packet > p, const TcpHeader &h, SocketWho who) override
Packet transmitted down to IP layer.
uint32_t m_testcase
Test case type.
void Rx(const Ptr< const Packet > p, const TcpHeader &h, SocketWho who) override
Packet received from IP layer.
TCP ECN TestSuite.
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 > 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.
TypeId m_congControlTypeId
Congestion control.
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.
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.
uint8_t MarkEcnEct0(uint8_t tos) const
Mark ECT(0) codepoint.
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
uint8_t MarkEcnCe(uint8_t tos) const
Mark CE codepoint.
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.
A TCP socket which sends certain data packets with CE flags set for tests 5 and 6.
uint32_t m_dataPacketSent
Number of packets sent.
void ReTxTimeout() override
An RTO event happened.
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,...
uint8_t m_testcase
Test case type.
static TypeId GetTypeId()
Get the type ID.
Ptr< TcpSocketBase > Fork() override
Call CopyObject<> to clone me.
TcpSocketCongestedRouter(const TcpSocketCongestedRouter &other)
Constructor.
void SetTestCase(uint8_t testCase)
Set the test case type.
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.
@ 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.
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
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
#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
#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
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static TcpEcnTestSuite g_tcpECNTestSuite
static var for test initialization
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.
Definition ptr.h:580