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 * 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 * Authors: Shravya Ks <shravya.ks0@gmail.com>
18 *
19 */
20#include "tcp-error-model.h"
21#include "tcp-general-test.h"
22
23#include "ns3/ipv4-end-point.h"
24#include "ns3/ipv4-interface-address.h"
25#include "ns3/ipv4-route.h"
26#include "ns3/ipv4-routing-protocol.h"
27#include "ns3/ipv4.h"
28#include "ns3/ipv6-end-point.h"
29#include "ns3/ipv6-route.h"
30#include "ns3/ipv6-routing-protocol.h"
31#include "ns3/ipv6.h"
32#include "ns3/log.h"
33#include "ns3/node.h"
34#include "ns3/tcp-l4-protocol.h"
35#include "ns3/tcp-rx-buffer.h"
36#include "ns3/tcp-tx-buffer.h"
37
38namespace ns3
39{
40
41NS_LOG_COMPONENT_DEFINE("TcpEcnTestSuite");
42
43/**
44 * \ingroup internet-test
45 *
46 * \brief checks if ECT, CWR and ECE bits are set correctly in different scenarios
47 *
48 * This test suite will run four combinations of enabling ECN (sender off and receiver off; sender
49 * on and receiver off; sender off and receiver on; sender on and receiver on;) and checks that the
50 * TOS byte of eventual packets transmitted or received have ECT, CWR, and ECE set correctly (or
51 * not). It also checks if congestion window is being reduced by half only once per every window on
52 * receipt of ECE flags
53 *
54 */
56{
57 public:
58 /**
59 * \brief Constructor
60 *
61 * \param testcase test case number
62 * \param desc Description about the ECN capabilities of sender and receiver
63 */
64 TcpEcnTest(uint32_t testcase, const std::string& desc);
65
66 protected:
67 void CWndTrace(uint32_t oldValue, uint32_t newValue) override;
68 void Rx(const Ptr<const Packet> p, const TcpHeader& h, SocketWho who) override;
69 void Tx(const Ptr<const Packet> p, const TcpHeader& h, SocketWho who) override;
71 void ConfigureProperties() override;
72
73 private:
74 uint32_t m_cwndChangeCount; //!< Number of times the congestion window did change
75 uint32_t m_senderSent; //!< Number of segments sent by the sender
76 uint32_t m_senderReceived; //!< Number of segments received by the sender
77 uint32_t m_receiverReceived; //!< Number of segments received by the receiver
78 uint32_t m_testcase; //!< Test case type
79};
80
81/**
82 * \ingroup internet-test
83 *
84 * \brief A TCP socket which sends certain data packets with CE flags set for tests 5 and 6.
85 *
86 * The SendDataPacket function of this class sends data packets numbered 1 and 3 with CE flags set
87 * for test 5 to verify if ECE and CWR bits are correctly set by receiver and sender respectively.
88 * It also sets CE flags on data packets 4 and 5 in test case 6 to check if sender reduces
89 * congestion window appropriately and also only once per every window.
90 *
91 */
93{
94 public:
95 /**
96 * \brief Get the type ID.
97 * \return the object TypeId
98 */
99 static TypeId GetTypeId();
100
101 uint32_t m_dataPacketSent; //!< Number of packets sent
102 uint8_t m_testcase; //!< Test case type
103
106 {
108 }
109
110 /**
111 * \brief Constructor.
112 * \param other The object to copy from.
113 */
115 : TcpSocketMsgBase(other)
116 {
117 }
118
119 /**
120 * Set the test case type
121 * \param testCase Test case type
122 */
123 void SetTestCase(uint8_t testCase);
124
125 protected:
126 uint32_t SendDataPacket(SequenceNumber32 seq, uint32_t maxSize, bool withAck) override;
127 void ReTxTimeout() override;
128 Ptr<TcpSocketBase> Fork() override;
129};
130
131NS_OBJECT_ENSURE_REGISTERED(TcpSocketCongestedRouter);
132
133TypeId
135{
136 static TypeId tid = TypeId("ns3::TcpSocketCongestedRouter")
138 .SetGroupName("Internet")
139 .AddConstructor<TcpSocketCongestedRouter>();
140 return tid;
141}
142
143void
145{
147}
148
149void
151{
152 m_testcase = testCase;
153}
154
157{
158 NS_LOG_FUNCTION(this << seq << maxSize << withAck);
160
161 bool isRetransmission = false;
162 if (seq != m_tcb->m_highTxMark)
163 {
164 isRetransmission = true;
165 }
166
167 Ptr<Packet> p = m_txBuffer->CopyFromSequence(maxSize, seq)->GetPacketCopy();
168 uint32_t sz = p->GetSize(); // Size of packet
169 uint8_t flags = withAck ? TcpHeader::ACK : 0;
170 uint32_t remainingData = m_txBuffer->SizeFromSequence(seq + SequenceNumber32(sz));
171
172 if (withAck)
173 {
175 m_delAckCount = 0;
176 }
177
178 // Sender should reduce the Congestion Window as a response to receiver's ECN Echo notification
179 // only once per window
181 m_ecnEchoSeq.Get() > m_ecnCWRSeq.Get() && !isRetransmission)
182 {
185 m_ecnCWRSeq = seq;
186 flags |= TcpHeader::CWR;
187 NS_LOG_INFO("CWR flags set");
188 }
189 /*
190 * Add tags for each socket option.
191 * Note that currently the socket adds both IPv4 tag and IPv6 tag
192 * if both options are set. Once the packet got to layer three, only
193 * the corresponding tags will be read.
194 */
195 if (GetIpTos())
196 {
197 SocketIpTosTag ipTosTag;
198 if ((m_testcase == 5 && (m_dataPacketSent == 1 || m_dataPacketSent == 3)) ||
199 (m_testcase == 6 && (m_dataPacketSent == 4 || m_dataPacketSent == 5)))
200 {
201 ipTosTag.SetTos(MarkEcnCe(GetIpTos()));
202 }
203 else
204 {
205 if (m_tcb->m_ecnState != TcpSocketState::ECN_DISABLED && (GetIpTos() & 0x3) == 0)
206 {
207 ipTosTag.SetTos(MarkEcnEct0(GetIpTos()));
208 }
209 else
210 {
211 ipTosTag.SetTos(GetIpTos());
212 }
213 }
214 p->AddPacketTag(ipTosTag);
215 }
216 else
217 {
218 SocketIpTosTag ipTosTag;
219 if ((m_testcase == 5 && (m_dataPacketSent == 1 || m_dataPacketSent == 3)) ||
220 (m_testcase == 6 && (m_dataPacketSent == 4 || m_dataPacketSent == 5)))
221 {
222 ipTosTag.SetTos(MarkEcnCe(GetIpTos()));
223 }
224 else
225 {
227 {
228 ipTosTag.SetTos(MarkEcnEct0(GetIpTos()));
229 }
230 }
231 p->AddPacketTag(ipTosTag);
232 }
233
234 if (IsManualIpv6Tclass())
235 {
236 SocketIpv6TclassTag ipTclassTag;
237 if ((m_testcase == 5 && (m_dataPacketSent == 1 || m_dataPacketSent == 3)) ||
238 (m_testcase == 6 && (m_dataPacketSent == 4 || m_dataPacketSent == 5)))
239 {
240 ipTclassTag.SetTclass(MarkEcnCe(GetIpv6Tclass()));
241 }
242 else
243 {
245 {
246 ipTclassTag.SetTclass(MarkEcnEct0(GetIpv6Tclass()));
247 }
248 else
249 {
250 ipTclassTag.SetTclass(GetIpv6Tclass());
251 }
252 }
253 p->AddPacketTag(ipTclassTag);
254 }
255 else
256 {
257 SocketIpv6TclassTag ipTclassTag;
258 if ((m_testcase == 5 && (m_dataPacketSent == 1 || m_dataPacketSent == 3)) ||
259 (m_testcase == 6 && (m_dataPacketSent == 4 || m_dataPacketSent == 5)))
260 {
261 ipTclassTag.SetTclass(MarkEcnCe(GetIpv6Tclass()));
262 }
263 else
264 {
266 {
267 ipTclassTag.SetTclass(MarkEcnEct0(GetIpv6Tclass()));
268 }
269 }
270 p->AddPacketTag(ipTclassTag);
271 }
272
273 if (IsManualIpTtl())
274 {
275 SocketIpTtlTag ipTtlTag;
276 ipTtlTag.SetTtl(GetIpTtl());
277 p->AddPacketTag(ipTtlTag);
278 }
279
281 {
282 SocketIpv6HopLimitTag ipHopLimitTag;
283 ipHopLimitTag.SetHopLimit(GetIpv6HopLimit());
284 p->AddPacketTag(ipHopLimitTag);
285 }
286
287 uint8_t priority = GetPriority();
288 if (priority)
289 {
290 SocketPriorityTag priorityTag;
291 priorityTag.SetPriority(priority);
292 p->ReplacePacketTag(priorityTag);
293 }
294
295 if (m_closeOnEmpty && (remainingData == 0))
296 {
297 flags |= TcpHeader::FIN;
298 if (m_state == ESTABLISHED)
299 { // On active close: I am the first one to send FIN
300 NS_LOG_DEBUG("ESTABLISHED -> FIN_WAIT_1");
302 }
303 else if (m_state == CLOSE_WAIT)
304 { // On passive close: Peer sent me FIN already
305 NS_LOG_DEBUG("CLOSE_WAIT -> LAST_ACK");
307 }
308 }
309 TcpHeader header;
310 header.SetFlags(flags);
311 header.SetSequenceNumber(seq);
312 header.SetAckNumber(m_tcb->m_rxBuffer->NextRxSequence());
313 if (m_endPoint)
314 {
317 }
318 else
319 {
322 }
324 AddOptions(header);
325
327 {
328 // Schedules retransmit timeout. m_rto should be already doubled.
329
330 NS_LOG_LOGIC(this << " SendDataPacket Schedule ReTxTimeout at time "
331 << Simulator::Now().GetSeconds() << " to expire at time "
332 << (Simulator::Now() + m_rto.Get()).GetSeconds());
334 }
335
336 m_txTrace(p, header, this);
337
338 if (m_endPoint)
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_endPoint->GetPeerAddress() << ". Header " << header);
348 }
349 else
350 {
351 m_tcp->SendPacket(p,
352 header,
356 NS_LOG_DEBUG("Send segment of size "
357 << sz << " with remaining data " << remainingData << " via TcpL4Protocol to "
358 << m_endPoint6->GetPeerAddress() << ". Header " << header);
359 }
360
361 UpdateRttHistory(seq, sz, isRetransmission);
362
363 // Notify the application of the data being sent unless this is a retransmit
364 if (seq + sz > m_tcb->m_highTxMark)
365 {
367 this,
368 (seq + sz - m_tcb->m_highTxMark.Get()));
369 }
370 // Update highTxMark
371 m_tcb->m_highTxMark = std::max(seq + sz, m_tcb->m_highTxMark.Get());
372 return sz;
373}
374
377{
378 return CopyObject<TcpSocketCongestedRouter>(this);
379}
380
381TcpEcnTest::TcpEcnTest(uint32_t testcase, const std::string& desc)
382 : TcpGeneralTest(desc),
383 m_cwndChangeCount(0),
384 m_senderSent(0),
385 m_senderReceived(0),
386 m_receiverReceived(0),
387 m_testcase(testcase)
388{
389}
390
391void
393{
395 if (m_testcase == 2 || m_testcase == 4 || m_testcase == 5 || m_testcase == 6)
396 {
398 }
399 if (m_testcase == 3 || m_testcase == 4 || m_testcase == 5 || m_testcase == 6)
400 {
402 }
403}
404
405void
407{
408 if (m_testcase == 6)
409 {
410 if (newValue < oldValue)
411 {
414 1,
415 "Congestion window should be reduced once per every window");
416 NS_TEST_ASSERT_MSG_EQ(newValue,
417 1000,
418 "Congestion window should not drop below 2 segments");
419 }
420 }
421}
422
423void
425{
426 if (who == RECEIVER)
427 {
428 if (m_receiverReceived == 0)
429 {
431 0,
432 "SYN should be received as first message at the receiver");
433 if (m_testcase == 2 || m_testcase == 4 || m_testcase == 5 || m_testcase == 6)
434 {
436 ((h.GetFlags()) & TcpHeader::ECE) && ((h.GetFlags()) & TcpHeader::CWR),
437 0,
438 "The flags ECE + CWR should be set in the TCP header of first message received "
439 "at receiver when sender is ECN Capable");
440 }
441 else
442 {
444 ((h.GetFlags()) & TcpHeader::ECE) && ((h.GetFlags()) & TcpHeader::CWR),
445 0,
446 "The flags ECE + CWR should not be set in the TCP header of first message "
447 "received at receiver when sender is not ECN Capable");
448 }
449 }
450 else if (m_receiverReceived == 1)
451 {
453 0,
454 "ACK should be received as second message at receiver");
455 }
456 else if (m_receiverReceived == 3 && m_testcase == 5)
457 {
459 0,
460 "Sender should send CWR on receipt of ECE");
461 }
463 }
464 else if (who == SENDER)
465 {
466 if (m_senderReceived == 0)
467 {
469 ((h.GetFlags()) & TcpHeader::ACK),
470 0,
471 "SYN+ACK received as first message at sender");
472 if (m_testcase == 4 || m_testcase == 5 || m_testcase == 6)
473 {
475 (h.GetFlags() & TcpHeader::ECE),
476 0,
477 "The flag ECE should be set in the TCP header of first message received at "
478 "sender when both receiver and sender are ECN Capable");
479 }
480 else
481 {
483 ((h.GetFlags()) & TcpHeader::ECE),
484 0,
485 "The flag ECE should not be set in the TCP header of first message received at "
486 "sender when either receiver or sender are not ECN Capable");
487 }
488 }
489 if (m_testcase == 5 && m_receiverReceived > 12)
490 {
492 0,
493 "The flag ECE should not be set in TCP header of the packet sent "
494 "by the receiver after sender sends CWR flags to receiver and "
495 "receiver receives a packet without CE bit set in IP header");
496 }
498 }
499}
500
501void
503{
504 if (who == SENDER)
505 {
506 m_senderSent++;
507 if (m_senderSent == 3)
508 {
509 SocketIpTosTag ipTosTag;
510 bool found = p->PeekPacketTag(ipTosTag);
511 uint16_t ipTos = 0;
512 if (found)
513 {
514 ipTos = static_cast<uint16_t>(ipTosTag.GetTos());
515 }
516 if (m_testcase == 4 || m_testcase == 6)
517 {
519 0x2,
520 "IP TOS should have ECT set if ECN negotiation between "
521 "endpoints is successful");
522 }
523 else if (m_testcase == 5)
524 {
525 if (m_senderSent == 3 || m_senderSent == 5)
526 {
528 ipTos,
529 0x3,
530 "IP TOS should have CE bit set for 3rd and 5th packet sent in test case 5");
531 }
532 else
533 {
535 0x2,
536 "IP TOS should have ECT set if ECN negotiation between "
537 "endpoints is successful");
538 }
539 }
540 else
541 {
543 0x2,
544 "IP TOS should not have ECT set if ECN negotiation between "
545 "endpoints is unsuccessful");
546 }
547 }
548 }
549}
550
553{
554 if (m_testcase == 5 || m_testcase == 6)
555 {
556 Ptr<TcpSocketCongestedRouter> socket = DynamicCast<TcpSocketCongestedRouter>(
558 socket->SetTestCase(m_testcase);
559 return socket;
560 }
561 else
562 {
564 }
565}
566
567/**
568 * \ingroup internet-test
569 *
570 * \brief TCP ECN TestSuite
571 */
573{
574 public:
576 : TestSuite("tcp-ecn-test", Type::UNIT)
577 {
579 1,
580 "ECN Negotiation Test : ECN incapable sender and ECN incapable receiver"),
583 new TcpEcnTest(2,
584 "ECN Negotiation Test : ECN capable sender and ECN incapable receiver"),
587 new TcpEcnTest(3,
588 "ECN Negotiation Test : ECN incapable sender and ECN capable receiver"),
591 new TcpEcnTest(4, "ECN Negotiation Test : ECN capable sender and ECN capable receiver"),
594 new TcpEcnTest(
595 5,
596 "ECE and CWR Functionality Test: ECN capable sender and ECN capable receiver"),
599 new TcpEcnTest(
600 6,
601 "Congestion Window Reduction Test :ECN capable sender and ECN capable receiver"),
603 }
604};
605
606static TcpEcnTestSuite g_tcpECNTestSuite; //!< static var for test initialization
607
608} // namespace ns3
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:77
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:571
static Time Now()
Return the current simulation virtual time.
Definition: simulator.cc:208
static EventId ScheduleNow(FUNC f, Ts &&... args)
Schedule an event to expire Now.
Definition: simulator.h:605
bool IsManualIpTtl() const
Checks if the socket has a specific IPv4 TTL set.
Definition: socket.cc:374
virtual uint8_t GetIpTtl() const
Query the value of IP Time to Live field of this socket.
Definition: socket.cc:517
uint8_t GetIpTos() const
Query the value of IP Type of Service of this socket.
Definition: socket.cc:450
Ptr< NetDevice > m_boundnetdevice
the device this socket is bound to (might be null).
Definition: socket.h:1081
virtual uint8_t GetIpv6HopLimit() const
Query the value of IP Hop Limit field of this socket.
Definition: socket.cc:542
void NotifyDataSent(uint32_t size)
Notify through the callback (if set) that some data have been sent.
Definition: socket.cc:282
uint8_t GetPriority() const
Query the priority value of this socket.
Definition: socket.cc:393
uint8_t GetIpv6Tclass() const
Query the value of IPv6 Traffic Class field of this socket.
Definition: socket.cc:492
bool IsManualIpv6HopLimit() const
Checks if the socket has a specific IPv6 Hop Limit set.
Definition: socket.cc:380
bool IsManualIpv6Tclass() const
Checks if the socket has a specific IPv6 Tclass set.
Definition: socket.cc:368
indicates whether the socket has IP_TOS set.
Definition: socket.h:1271
void SetTos(uint8_t tos)
Set the tag's TOS.
Definition: socket.cc:798
uint8_t GetTos() const
Get the tag's TOS.
Definition: socket.cc:804
This class implements a tag that carries the socket-specific TTL of a packet to the IP layer.
Definition: socket.h:1124
void SetTtl(uint8_t ttl)
Set the tag's TTL.
Definition: socket.cc:604
This class implements a tag that carries the socket-specific HOPLIMIT of a packet to the IPv6 layer.
Definition: socket.h:1172
void SetHopLimit(uint8_t hopLimit)
Set the tag's Hop Limit.
Definition: socket.cc:668
indicates whether the socket has IPV6_TCLASS set.
Definition: socket.h:1366
void SetTclass(uint8_t tclass)
Set the tag's Tclass.
Definition: socket.cc:910
indicates whether the socket has a priority set.
Definition: socket.h:1318
void SetPriority(uint8_t priority)
Set the tag's priority.
Definition: socket.cc:854
checks if ECT, CWR and ECE bits are set correctly in different scenarios
Definition: tcp-ecn-test.cc:56
void ConfigureProperties() override
Change the configuration of the socket properties.
uint32_t m_senderSent
Number of segments sent by the sender.
Definition: tcp-ecn-test.cc:75
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.
Definition: tcp-ecn-test.cc:74
uint32_t m_senderReceived
Number of segments received by the sender.
Definition: tcp-ecn-test.cc:76
uint32_t m_receiverReceived
Number of segments received by the receiver.
Definition: tcp-ecn-test.cc:77
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.
Definition: tcp-ecn-test.cc:78
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:47
void SetDestinationPort(uint16_t port)
Set the destination port.
Definition: tcp-header.cc:70
void SetSequenceNumber(SequenceNumber32 sequenceNumber)
Set the sequence Number.
Definition: tcp-header.cc:76
void SetFlags(uint8_t flags)
Set flags of the header.
Definition: tcp-header.cc:88
void SetWindowSize(uint16_t windowSize)
Set the window size.
Definition: tcp-header.cc:94
void SetSourcePort(uint16_t port)
Set the source port.
Definition: tcp-header.cc:64
void SetAckNumber(SequenceNumber32 ackNumber)
Set the ACK number.
Definition: tcp-header.cc:82
uint8_t GetFlags() const
Get the flags.
Definition: tcp-header.cc:148
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.
Definition: tcp-ecn-test.cc:93
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.
TracedValue< SequenceNumber32 > m_highTxMark
Highest seqno ever sent, regardless of ReTx.
@ 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.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:302
A suite of tests to run.
Definition: test.h:1273
Type
Type of test.
Definition: test.h:1280
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:403
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:932
#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:145
#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:565
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static TcpEcnTestSuite g_tcpECNTestSuite
static var for test initialization