A Discrete-Event Network Simulator
API
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
57{
58 public:
65 TcpEcnTest(uint32_t testcase, const std::string& desc);
66
67 protected:
68 void CWndTrace(uint32_t oldValue, uint32_t newValue) override;
69 void Rx(const Ptr<const Packet> p, const TcpHeader& h, SocketWho who) override;
70 void Tx(const Ptr<const Packet> p, const TcpHeader& h, SocketWho who) override;
72 void ConfigureProperties() override;
73
74 private:
80};
81
95{
96 public:
101 static TypeId GetTypeId();
102
104 uint8_t m_testcase;
105
108 {
110 }
111
117 : TcpSocketMsgBase(other)
118 {
119 }
120
125 void SetTestCase(uint8_t testCase);
126
127 protected:
128 uint32_t SendDataPacket(SequenceNumber32 seq, uint32_t maxSize, bool withAck) override;
129 void ReTxTimeout() override;
130 Ptr<TcpSocketBase> Fork() override;
131};
132
133NS_OBJECT_ENSURE_REGISTERED(TcpSocketCongestedRouter);
134
135TypeId
137{
138 static TypeId tid = TypeId("ns3::TcpSocketCongestedRouter")
140 .SetGroupName("Internet")
141 .AddConstructor<TcpSocketCongestedRouter>();
142 return tid;
143}
144
145void
147{
149}
150
151void
153{
154 m_testcase = testCase;
155}
156
159{
160 NS_LOG_FUNCTION(this << seq << maxSize << withAck);
162
163 bool isRetransmission = false;
164 if (seq != m_tcb->m_highTxMark)
165 {
166 isRetransmission = true;
167 }
168
169 Ptr<Packet> p = m_txBuffer->CopyFromSequence(maxSize, seq)->GetPacketCopy();
170 uint32_t sz = p->GetSize(); // Size of packet
171 uint8_t flags = withAck ? TcpHeader::ACK : 0;
172 uint32_t remainingData = m_txBuffer->SizeFromSequence(seq + SequenceNumber32(sz));
173
174 if (withAck)
175 {
177 m_delAckCount = 0;
178 }
179
180 // Sender should reduce the Congestion Window as a response to receiver's ECN Echo notification
181 // only once per window
183 m_ecnEchoSeq.Get() > m_ecnCWRSeq.Get() && !isRetransmission)
184 {
187 m_ecnCWRSeq = seq;
188 flags |= TcpHeader::CWR;
189 NS_LOG_INFO("CWR flags set");
190 }
191 /*
192 * Add tags for each socket option.
193 * Note that currently the socket adds both IPv4 tag and IPv6 tag
194 * if both options are set. Once the packet got to layer three, only
195 * the corresponding tags will be read.
196 */
197 if (GetIpTos())
198 {
199 SocketIpTosTag ipTosTag;
200 if (m_testcase == 5 && (m_dataPacketSent == 1 || m_dataPacketSent == 3))
201 {
202 ipTosTag.SetTos(MarkEcnCe(GetIpTos()));
203 }
204 else if (m_testcase == 6 && (m_dataPacketSent == 4 || m_dataPacketSent == 5))
205 {
206 ipTosTag.SetTos(MarkEcnCe(GetIpTos()));
207 }
208 else
209 {
210 if (m_tcb->m_ecnState != TcpSocketState::ECN_DISABLED && (GetIpTos() & 0x3) == 0)
211 {
212 ipTosTag.SetTos(MarkEcnEct0(GetIpTos()));
213 }
214 else
215 {
216 ipTosTag.SetTos(GetIpTos());
217 }
218 }
219 p->AddPacketTag(ipTosTag);
220 }
221 else
222 {
223 SocketIpTosTag ipTosTag;
224 if (m_testcase == 5 && (m_dataPacketSent == 1 || m_dataPacketSent == 3))
225 {
226 ipTosTag.SetTos(MarkEcnCe(GetIpTos()));
227 }
228 else if (m_testcase == 6 && (m_dataPacketSent == 4 || m_dataPacketSent == 5))
229 {
230 ipTosTag.SetTos(MarkEcnCe(GetIpTos()));
231 }
232 else
233 {
235 {
236 ipTosTag.SetTos(MarkEcnEct0(GetIpTos()));
237 }
238 }
239 p->AddPacketTag(ipTosTag);
240 }
241
242 if (IsManualIpv6Tclass())
243 {
244 SocketIpv6TclassTag ipTclassTag;
245 if (m_testcase == 5 && (m_dataPacketSent == 1 || m_dataPacketSent == 3))
246 {
247 ipTclassTag.SetTclass(MarkEcnCe(GetIpv6Tclass()));
248 }
249 else if (m_testcase == 6 && (m_dataPacketSent == 4 || m_dataPacketSent == 5))
250 {
251 ipTclassTag.SetTclass(MarkEcnCe(GetIpv6Tclass()));
252 }
253 else
254 {
256 {
257 ipTclassTag.SetTclass(MarkEcnEct0(GetIpv6Tclass()));
258 }
259 else
260 {
261 ipTclassTag.SetTclass(GetIpv6Tclass());
262 }
263 }
264 p->AddPacketTag(ipTclassTag);
265 }
266 else
267 {
268 SocketIpv6TclassTag ipTclassTag;
269 if (m_testcase == 5 && (m_dataPacketSent == 1 || m_dataPacketSent == 3))
270 {
271 ipTclassTag.SetTclass(MarkEcnCe(GetIpv6Tclass()));
272 }
273 else if (m_testcase == 6 && (m_dataPacketSent == 4 || m_dataPacketSent == 5))
274 {
275 ipTclassTag.SetTclass(MarkEcnCe(GetIpv6Tclass()));
276 }
277 else
278 {
280 {
281 ipTclassTag.SetTclass(MarkEcnEct0(GetIpv6Tclass()));
282 }
283 }
284 p->AddPacketTag(ipTclassTag);
285 }
286
287 if (IsManualIpTtl())
288 {
289 SocketIpTtlTag ipTtlTag;
290 ipTtlTag.SetTtl(GetIpTtl());
291 p->AddPacketTag(ipTtlTag);
292 }
293
295 {
296 SocketIpv6HopLimitTag ipHopLimitTag;
297 ipHopLimitTag.SetHopLimit(GetIpv6HopLimit());
298 p->AddPacketTag(ipHopLimitTag);
299 }
300
301 uint8_t priority = GetPriority();
302 if (priority)
303 {
304 SocketPriorityTag priorityTag;
305 priorityTag.SetPriority(priority);
306 p->ReplacePacketTag(priorityTag);
307 }
308
309 if (m_closeOnEmpty && (remainingData == 0))
310 {
311 flags |= TcpHeader::FIN;
312 if (m_state == ESTABLISHED)
313 { // On active close: I am the first one to send FIN
314 NS_LOG_DEBUG("ESTABLISHED -> FIN_WAIT_1");
316 }
317 else if (m_state == CLOSE_WAIT)
318 { // On passive close: Peer sent me FIN already
319 NS_LOG_DEBUG("CLOSE_WAIT -> LAST_ACK");
321 }
322 }
323 TcpHeader header;
324 header.SetFlags(flags);
325 header.SetSequenceNumber(seq);
326 header.SetAckNumber(m_tcb->m_rxBuffer->NextRxSequence());
327 if (m_endPoint)
328 {
331 }
332 else
333 {
336 }
338 AddOptions(header);
339
341 {
342 // Schedules retransmit timeout. m_rto should be already doubled.
343
344 NS_LOG_LOGIC(this << " SendDataPacket Schedule ReTxTimeout at time "
345 << Simulator::Now().GetSeconds() << " to expire at time "
346 << (Simulator::Now() + m_rto.Get()).GetSeconds());
348 }
349
350 m_txTrace(p, header, this);
351
352 if (m_endPoint)
353 {
354 m_tcp->SendPacket(p,
355 header,
359 NS_LOG_DEBUG("Send segment of size "
360 << sz << " with remaining data " << remainingData << " via TcpL4Protocol to "
361 << m_endPoint->GetPeerAddress() << ". Header " << header);
362 }
363 else
364 {
365 m_tcp->SendPacket(p,
366 header,
370 NS_LOG_DEBUG("Send segment of size "
371 << sz << " with remaining data " << remainingData << " via TcpL4Protocol to "
372 << m_endPoint6->GetPeerAddress() << ". Header " << header);
373 }
374
375 UpdateRttHistory(seq, sz, isRetransmission);
376
377 // Notify the application of the data being sent unless this is a retransmit
378 if (seq + sz > m_tcb->m_highTxMark)
379 {
381 this,
382 (seq + sz - m_tcb->m_highTxMark.Get()));
383 }
384 // Update highTxMark
386 return sz;
387}
388
391{
392 return CopyObject<TcpSocketCongestedRouter>(this);
393}
394
395TcpEcnTest::TcpEcnTest(uint32_t testcase, const std::string& desc)
396 : TcpGeneralTest(desc),
397 m_cwndChangeCount(0),
398 m_senderSent(0),
399 m_senderReceived(0),
400 m_receiverReceived(0),
401 m_testcase(testcase)
402{
403}
404
405void
407{
409 if (m_testcase == 2 || m_testcase == 4 || m_testcase == 5 || m_testcase == 6)
410 {
412 }
413 if (m_testcase == 3 || m_testcase == 4 || m_testcase == 5 || m_testcase == 6)
414 {
416 }
417}
418
419void
421{
422 if (m_testcase == 6)
423 {
424 if (newValue < oldValue)
425 {
428 1,
429 "Congestion window should be reduced once per every window");
430 NS_TEST_ASSERT_MSG_EQ(newValue,
431 1000,
432 "Congestion window should not drop below 2 segments");
433 }
434 }
435}
436
437void
439{
440 if (who == RECEIVER)
441 {
442 if (m_receiverReceived == 0)
443 {
445 0,
446 "SYN should be received as first message at the receiver");
447 if (m_testcase == 2 || m_testcase == 4 || m_testcase == 5 || m_testcase == 6)
448 {
450 ((h.GetFlags()) & TcpHeader::ECE) && ((h.GetFlags()) & TcpHeader::CWR),
451 0,
452 "The flags ECE + CWR should be set in the TCP header of first message received "
453 "at receiver when sender is ECN Capable");
454 }
455 else
456 {
458 ((h.GetFlags()) & TcpHeader::ECE) && ((h.GetFlags()) & TcpHeader::CWR),
459 0,
460 "The flags ECE + CWR should not be set in the TCP header of first message "
461 "received at receiver when sender is not ECN Capable");
462 }
463 }
464 else if (m_receiverReceived == 1)
465 {
467 0,
468 "ACK should be received as second message at receiver");
469 }
470 else if (m_receiverReceived == 3 && m_testcase == 5)
471 {
473 0,
474 "Sender should send CWR on receipt of ECE");
475 }
477 }
478 else if (who == SENDER)
479 {
480 if (m_senderReceived == 0)
481 {
483 ((h.GetFlags()) & TcpHeader::ACK),
484 0,
485 "SYN+ACK received as first message at sender");
486 if (m_testcase == 4 || m_testcase == 5 || m_testcase == 6)
487 {
489 (h.GetFlags() & TcpHeader::ECE),
490 0,
491 "The flag ECE should be set in the TCP header of first message received at "
492 "sender when both receiver and sender are ECN Capable");
493 }
494 else
495 {
497 ((h.GetFlags()) & TcpHeader::ECE),
498 0,
499 "The flag ECE should not be set in the TCP header of first message received at "
500 "sender when either receiver or sender are not ECN Capable");
501 }
502 }
503 if (m_testcase == 5 && m_receiverReceived > 12)
504 {
506 0,
507 "The flag ECE should not be set in TCP header of the packet sent "
508 "by the receiver after sender sends CWR flags to receiver and "
509 "receiver receives a packet without CE bit set in IP header");
510 }
512 }
513}
514
515void
517{
518 if (who == SENDER)
519 {
520 m_senderSent++;
521 if (m_senderSent == 3)
522 {
523 SocketIpTosTag ipTosTag;
524 bool found = p->PeekPacketTag(ipTosTag);
525 uint16_t ipTos = 0;
526 if (found)
527 {
528 ipTos = static_cast<uint16_t>(ipTosTag.GetTos());
529 }
530 if (m_testcase == 4 || m_testcase == 6)
531 {
533 0x2,
534 "IP TOS should have ECT set if ECN negotiation between "
535 "endpoints is successful");
536 }
537 else if (m_testcase == 5)
538 {
539 if (m_senderSent == 3 || m_senderSent == 5)
540 {
542 ipTos,
543 0x3,
544 "IP TOS should have CE bit set for 3rd and 5th packet sent in test case 5");
545 }
546 else
547 {
549 0x2,
550 "IP TOS should have ECT set if ECN negotiation between "
551 "endpoints is successful");
552 }
553 }
554 else
555 {
557 0x2,
558 "IP TOS should not have ECT set if ECN negotiation between "
559 "endpoints is unsuccessful");
560 }
561 }
562 }
563}
564
567{
568 if (m_testcase == 5 || m_testcase == 6)
569 {
570 Ptr<TcpSocketCongestedRouter> socket = DynamicCast<TcpSocketCongestedRouter>(
572 socket->SetTestCase(m_testcase);
573 return socket;
574 }
575 else
576 {
578 }
579}
580
588{
589 public:
591 : TestSuite("tcp-ecn-test", UNIT)
592 {
594 1,
595 "ECN Negotiation Test : ECN incapable sender and ECN incapable receiver"),
598 new TcpEcnTest(2,
599 "ECN Negotiation Test : ECN capable sender and ECN incapable receiver"),
602 new TcpEcnTest(3,
603 "ECN Negotiation Test : ECN incapable sender and ECN capable receiver"),
606 new TcpEcnTest(4, "ECN Negotiation Test : ECN capable sender and ECN capable receiver"),
609 new TcpEcnTest(
610 5,
611 "ECE and CWR Functionality Test: ECN capable sender and ECN capable receiver"),
614 new TcpEcnTest(
615 6,
616 "Congestion Window Reduction Test :ECN capable sender and ECN capable receiver"),
618 }
619};
620
622
623} // namespace ns3
#define max(a, b)
Definition: 80211b.c:43
void Cancel()
This method is syntactic sugar for the ns3::Simulator::Cancel method.
Definition: event-id.cc:55
bool IsExpired() const
This method is syntactic sugar for the ns3::Simulator::IsExpired method.
Definition: event-id.cc:69
Ipv4Address GetPeerAddress()
Get the peer address.
uint16_t GetPeerPort()
Get the peer port.
uint16_t GetLocalPort()
Get the local port.
Ipv4Address GetLocalAddress()
Get the local address.
Ipv6Address GetLocalAddress()
Get the local address.
uint16_t GetLocalPort()
Get the local port.
Ipv6Address GetPeerAddress()
Get the peer address.
uint16_t GetPeerPort()
Get the peer port.
uint32_t GetSize() const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:863
void AddPacketTag(const Tag &tag) const
Add a packet tag.
Definition: packet.cc:979
bool PeekPacketTag(Tag &tag) const
Search a matching tag and call Tag::Deserialize if it is found.
Definition: packet.cc:1002
bool ReplacePacketTag(Tag &tag)
Replace the value of a packet tag.
Definition: packet.cc:994
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:568
static Time Now()
Return the current simulation virtual time.
Definition: simulator.cc:199
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
checks if ECT, CWR and ECE bits are set correctly in different scenarios
Definition: tcp-ecn-test.cc:57
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:76
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:75
uint32_t m_senderReceived
Number of segments received by the sender.
Definition: tcp-ecn-test.cc:77
uint32_t m_receiverReceived
Number of segments received by the receiver.
Definition: tcp-ecn-test.cc:78
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:79
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: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
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:95
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.
@ 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:305
A suite of tests to run.
Definition: test.h:1256
@ UNIT
This test suite implements a Unit Test.
Definition: test.h:1265
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:402
T Get() const
Get the underlying value.
Definition: traced-value.h:249
a unique identifier for an interface.
Definition: type-id.h:60
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:935
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:268
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:282
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:275
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
SequenceNumber< uint32_t, int32_t > SequenceNumber32
32 bit Sequence number.
@ 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
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static TcpEcnTestSuite g_tcpECNTestSuite
static var for test initialization