Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
ed74220
packet: keep the fill byte when splitting a BitCountChunk or ByteCoun…
rhornig Jul 27, 2026
a705db8
ppp: follow RFC 1661 rather than RFC 1331
rhornig Jul 27, 2026
21d34de
pcap: record PPP traces as LINKTYPE_PPP rather than LINKTYPE_PPP_WITH…
rhornig Jul 27, 2026
c258fd7
tcp: add the TCP Fast Open and AccECN header options, and the AE bit
rhornig Jul 27, 2026
9de16ef
tcp: extend the socket contract with the commands, tags and status fi…
rhornig Jul 27, 2026
05704c0
tcp: allow the receive-window and timestamp parameters to change at r…
rhornig Jul 27, 2026
747ec0f
ppp: byte-align a packet truncated by a mid-transmission disconnect
rhornig Jul 27, 2026
99e3e24
doc: refresh the TCP RFC citations to the current documents
rhornig Jul 27, 2026
f9c4974
tcp: collect the TCP signals into one place
rhornig Jul 27, 2026
96b310f
tcp: introduce the congestion-control and recovery interfaces
rhornig Jul 27, 2026
c816bf1
tcp: extract the RFC 5681 congestion control and fast recovery
rhornig Jul 27, 2026
3119cd7
tcp: extract the RFC 6582 (NewReno) recovery
rhornig Jul 27, 2026
f125f40
tcp: move SACK loss recovery into Rfc6675Recovery
rhornig Jul 27, 2026
2f35d7c
tcp: add TcpCubic (RFC 9438) with HyStart
rhornig Jul 27, 2026
ed2c8df
tcp: move the classic flavours onto the split architecture
rhornig Jul 27, 2026
81713e2
tcp: size segments against the space options actually leave
rhornig Jul 27, 2026
6d3b0fd
tcp: judge loss by transmission time (RFC 8985)
rhornig Jul 27, 2026
838e6d2
tcp: learn how far the path reorders
rhornig Jul 27, 2026
ffefa0d
tcp: pace the window down across recovery (RFC 6937)
rhornig Jul 27, 2026
eb549a1
tcp: undo a reduction that turned out to be unnecessary
rhornig Jul 27, 2026
488b84a
tcp: recognise a premature retransmission timeout (RFC 5682)
rhornig Jul 27, 2026
4b46417
tcp: probe the tail rather than waiting out the timeout
rhornig Jul 27, 2026
710b182
tcp: TCP Fast Open (RFC 7413)
rhornig Jul 27, 2026
7327e5c
tcp: Accurate ECN
rhornig Jul 27, 2026
1a9200e
tcp: separate the receive buffer from the advertised window
rhornig Jul 27, 2026
125b855
tcp: adapt the acknowledgement delay to the connection
rhornig Jul 27, 2026
3616a5a
tcp: keepalive probing (RFC 1122 4.2.3.6)
rhornig Jul 27, 2026
a4317c0
tcp: the socket options the new behavior exposes
rhornig Jul 27, 2026
b479ccc
tcp: mark write boundaries with PSH
rhornig Jul 27, 2026
d8a21d0
tcp: segment-size negotiation and path MTU handling
rhornig Jul 27, 2026
8bbf0d5
tcp: retransmission, persist and handshake timing
rhornig Jul 27, 2026
2fec577
tcp: connection plumbing the modern features share
rhornig Jul 27, 2026
e24da2c
tcp: expose the new behavior as parameters, and modernize the defaults
rhornig Jul 27, 2026
9f40ee3
tests: re-record the fingerprints the modernized defaults move
rhornig Jul 27, 2026
5b41708
tests: cover the new behavior, and pin the old defaults where tests p…
rhornig Jul 27, 2026
3681f2f
sctp: follow the TCP algorithm interface rename
rhornig Jul 27, 2026
1c0e7a2
tcpapp: let applications drive the new socket behavior
rhornig Jul 27, 2026
06853ca
tcp: three Fast Open fixes the oracle surfaced
rhornig Jul 28, 2026
c0ec1b6
tcp: finish the Fast Open option-form fallback, and the server's pre-…
rhornig Jul 29, 2026
e04d92d
tcp: match Linux's CUBIC HyStart delay detector
rhornig Jul 29, 2026
4ab4c4d
tcp: RFC 4821 packetized Path MTU discovery
rhornig Jul 29, 2026
c7ae494
tcp: model the receive buffer's memory limits, not just its byte count
rhornig Jul 29, 2026
e082586
tcp: document every RFC the module implements, and where it deviates
rhornig Jul 29, 2026
4190b19
tcp: keep the lost mark when a retransmission splits a SACK queue region
rhornig Jul 29, 2026
f2b5fd1
tcp: clamp the snd_wnd-pipe underflow in RFC 6675 nextSeg rule (2)
rhornig Jul 29, 2026
429e8cc
tcp: drop unusable SACK options instead of aborting the simulation
rhornig Jul 29, 2026
e91fcac
tcp: serialize the experimental TCP Fast Open option (kind 254)
rhornig Jul 29, 2026
8af4179
tcp: compare increasedIWEnabled against initialWindow's real default
rhornig Jul 29, 2026
37d121a
tcp: wire the classic RFC 3168 ECN reaction back into the ACK path
rhornig Jul 29, 2026
5d94c07
tcp: count duplicate ACKs for every flavour again, not just the class…
rhornig Jul 29, 2026
7d52875
tcp: deflate cwnd when non-SACK Reno leaves fast recovery
rhornig Jul 29, 2026
fea41a0
tcp: put TcpCubic on TcpClassicAlgorithmBase so it gets the shared pl…
rhornig Jul 29, 2026
0776e15
tcpapp: let TcpServerSocketIo keep a half-closed connection open again
rhornig Jul 29, 2026
8522c2e
tcp: drop the unused PRR entry helper and explain the dupack design i…
rhornig Jul 29, 2026
4fe69b2
tcp: pick the fast-retransmit ssthresh by virtual, not by concrete-ty…
rhornig Jul 29, 2026
a189f07
tcp: stop rescanning the SACK scoreboard several times per ACK
rhornig Jul 29, 2026
0a5d02a
tcp: document why DcTcp's ACK path is a fork, not a specialization
rhornig Jul 29, 2026
b2a8822
tcp_lwip: record the sent-seqno statistic under the same name as tcp
rhornig Jul 29, 2026
8aa9f74
tcp: drop test-corpus provenance from code comments
rhornig Jul 29, 2026
f121cec
tcp: fold DcTcp onto the shared ACK path, leaving only what is DCTCP's
rhornig Jul 29, 2026
33e8b0d
tests: re-record the fingerprints this TCP workstream moves
rhornig Jul 29, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 12 additions & 13 deletions doc/src/developers-guide/ch-tcp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,9 @@ The :ned:`Tcp` module has the following parameters:
receiver buffer capacity (Note: normally, NIC queues should be at
least this size, default is 14*mss)

- :par:`delayedAcksEnabled` delayed ACK algorithm (RFC 1122)
enabled/disabled
- :par:`delayedAcksEnabled` delayed ACK algorithm (RFC 1122) enabled/disabled

- :par:`nagleEnabled` Nagles algorithm (RFC 896) enabled/disabled
- :par:`nagleEnabled` Nagle's algorithm (RFC 1122) enabled/disabled

- :par:`limitedTransmitEnabled` Limited Transmit algorithm (RFC 3042)
enabled/disabled (can be used for
Expand All @@ -123,18 +122,18 @@ The :ned:`Tcp` module has the following parameters:
- :par:`increasedIWEnabled` Increased Initial Window (RFC 3390)
enabled/disabled

- :par:`sackSupport` Selective Acknowledgment (RFC 2018, 2883, 3517)
- :par:`sackSupport` Selective Acknowledgment (RFC 2018, 2883, 6675)
support (header option) (SACK will be enabled for a connection if
both endpoints support it)

- :par:`windowScalingSupport` Window Scale (RFC 1323) support (header
- :par:`windowScalingSupport` Window Scale (RFC 7323) support (header
option) (WS will be enabled for a connection if both endpoints
support it)

- :par:`timestampSupport` Timestamps (RFC 1323) support (header option)
- :par:`timestampSupport` Timestamps (RFC 7323) support (header option)
(TS will be enabled for a connection if both endpoints support it)

- :par:`mss` Maximum Segment Size (RFC 793) (header option, default is
- :par:`mss` Maximum Segment Size (RFC 9293) (header option, default is
536)

- :par:`tcpAlgorithmClass` the name of the TCP flavour
Expand Down Expand Up @@ -244,7 +243,7 @@ receives a TCP_I_CONNECTION_REFUSED message.
If you do an active OPEN, then send data and close before the connection
has reached ESTABLISHED, the connection will go from SYN_SENT to CLOSED
without actually sending the buffered data. This is consistent with
RFC 793 but may not be what you would expect.
RFC 9293 but may not be what you would expect.



Expand Down Expand Up @@ -403,10 +402,10 @@ etc. Because this algorithm does not send duplicate ACKs when it receives
out-of-order segments, it does not work well together with other
algorithms.

TcpBaseAlg
TcpAlgorithmBase
~~~~~~~~~~

The :cpp:`TcpBaseAlg` is the base class of the INET implementation of
The :cpp:`TcpAlgorithmBase` is the base class of the INET implementation of
Tahoe, Reno, and NewReno. It implements basic TCP algorithms for
adaptive retransmissions, persistence timers, delayed ACKs, Nagle’s
algorithm, Increased Initial Window – EXCLUDING congestion control.
Expand All @@ -416,7 +415,7 @@ Delayed ACK
^^^^^^^^^^^

When the :par:`delayedAcksEnabled` parameter is set to true, the
:cpp:`TcpBaseAlg` applies a 200ms delay before sending ACKs.
:cpp:`TcpAlgorithmBase` applies a 200ms delay before sending ACKs.

Nagle’s algorithm
^^^^^^^^^^^^^^^^^
Expand All @@ -443,7 +442,7 @@ If the :par:`increasedIWEnabled` parameter is true, then the initial
window is increased to 4380 bytes, but at least 2 SMSS and at most 4
SMSS. The congestion window is not updated afterwards; subclasses can
add congestion control by redefining virtual methods of the
:cpp:`TcpBaseAlg` class in their own class implementation.
:cpp:`TcpAlgorithmBase` class in their own class implementation.

Duplicate ACKs
^^^^^^^^^^^^^^
Expand All @@ -469,7 +468,7 @@ Can be used to demonstrate the effect of lack of congestion control.
TcpTahoe
~~~~~~~~

The :cpp:`TcpTahoe` algorithm class extends :cpp:`TcpBaseAlg` with *Slow
The :cpp:`TcpTahoe` algorithm class extends :cpp:`TcpAlgorithmBase` with *Slow
Start*, *Congestion Avoidance*, and *Fast Retransmit* congestion control
algorithms. This algorithm initiates a *Slow Start* when a packet loss
is detected.
Expand Down
2 changes: 2 additions & 0 deletions doc/src/msgtags.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
<filename>types/msg-inet--aodv--Rreq.html</filename>
</compound>
<compound kind="class">
<name>TcpAlgorithmBaseStateVariables</name>
<filename>inet-tcp-TcpAlgorithmBaseStateVariables.html</filename>
<name>UnreachableNode</name>
<filename>types/msg-inet--aodv--UnreachableNode.html</filename>
</compound>
Expand Down
2 changes: 1 addition & 1 deletion doc/src/users-guide/ch-transport.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Overview
The TCP protocol is the most widely used protocol of the Internet. It
provides reliable, ordered delivery of a stream of bytes from one
application on one computer to another application on another computer.
The baseline TCP protocol is described in RFC793, but other tens of RFCs
The baseline TCP protocol is described in RFC 9293, but other tens of RFCs
contain modifications and extensions to TCP. As a result, TCP is a
complex protocol and sometimes it is hard to see how the different
requirements interact with each other.
Expand Down
10 changes: 5 additions & 5 deletions examples/emulation/extserver/omnetpp.ini
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ abstract = true
**.tcp.typename = "Tcp"
**.tcp.advertisedWindow = 65535 # in bytes, corresponds with the maximal receiver buffer capacity (Note: normally, NIC queues should be at least this size)
**.tcp.delayedAcksEnabled = false # delayed ACK algorithm (RFC 1122) enabled/disabled
**.tcp.nagleEnabled = true # Nagle's algorithm (RFC 896) enabled/disabled
**.tcp.nagleEnabled = true # Nagle's algorithm (RFC 1122) enabled/disabled
**.tcp.limitedTransmitEnabled = false # Limited Transmit algorithm (RFC 3042) enabled/disabled (can be used for TcpReno/TcpTahoe/TcpNewReno/TcpNoCongestionControl)
**.tcp.increasedIWEnabled = false # Increased Initial Window (RFC 3390) enabled/disabled
**.tcp.sackSupport = true # Selective Acknowledgment (RFC 2018, 2883, 3517) support (header option) (SACK will be enabled for a connection if both endpoints support it)
**.tcp.windowScalingSupport = false # Window Scale (RFC 1323) support (header option) (WS will be enabled for a connection if both endpoints support it)
**.tcp.timestampSupport = false # Timestamps (RFC 1323) support (header option) (TS will be enabled for a connection if both endpoints support it)
**.tcp.mss = 1452 # Maximum Segment Size (RFC 793) (header option)
**.tcp.sackSupport = true # Selective Acknowledgment (RFC 2018, 2883, 6675) support (header option) (SACK will be enabled for a connection if both endpoints support it)
**.tcp.windowScalingSupport = false # Window Scale (RFC 7323) support (header option) (WS will be enabled for a connection if both endpoints support it)
**.tcp.timestampSupport = false # Timestamps (RFC 7323) support (header option) (TS will be enabled for a connection if both endpoints support it)
**.tcp.mss = 1452 # Maximum Segment Size (RFC 9293) (header option)
**.tcp.tcpAlgorithmClass = "TcpReno" # TcpReno/TcpTahoe/TcpNewReno/TcpNoCongestionControl/DumbTcp

# pcapRecorder settings
Expand Down
10 changes: 5 additions & 5 deletions examples/inet/ber/omnetpp.ini
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ abstract = true
**.tcp.typename = "Tcp"
**.tcp.advertisedWindow = 65535 # in bytes, corresponds with the maximal receiver buffer capacity (Note: normally, NIC queues should be at least this size)
**.tcp.delayedAcksEnabled = false # delayed ACK algorithm (RFC 1122) enabled/disabled
**.tcp.nagleEnabled = true # Nagle's algorithm (RFC 896) enabled/disabled
**.tcp.nagleEnabled = true # Nagle's algorithm (RFC 1122) enabled/disabled
**.tcp.limitedTransmitEnabled = false # Limited Transmit algorithm (RFC 3042) enabled/disabled (can be used for TcpReno/TcpTahoe/TcpNewReno/TcpNoCongestionControl)
**.tcp.increasedIWEnabled = false # Increased Initial Window (RFC 3390) enabled/disabled
**.tcp.sackSupport = false # Selective Acknowledgment (RFC 2018, 2883, 3517) support (header option) (SACK will be enabled for a connection if both endpoints support it)
**.tcp.windowScalingSupport = false # Window Scale (RFC 1323) support (header option) (WS will be enabled for a connection if both endpoints support it)
**.tcp.timestampSupport = false # Timestamps (RFC 1323) support (header option) (TS will be enabled for a connection if both endpoints support it)
**.tcp.mss = 1452 # Maximum Segment Size (RFC 793) (header option)
**.tcp.sackSupport = false # Selective Acknowledgment (RFC 2018, 2883, 6675) support (header option) (SACK will be enabled for a connection if both endpoints support it)
**.tcp.windowScalingSupport = false # Window Scale (RFC 7323) support (header option) (WS will be enabled for a connection if both endpoints support it)
**.tcp.timestampSupport = false # Timestamps (RFC 7323) support (header option) (TS will be enabled for a connection if both endpoints support it)
**.tcp.mss = 1452 # Maximum Segment Size (RFC 9293) (header option)
**.tcp.tcpAlgorithmClass = "TcpReno" # TcpReno/TcpTahoe/TcpNewReno/TcpNoCongestionControl/DumbTcp

# RNG/seed settings
Expand Down
8 changes: 4 additions & 4 deletions examples/inet/dctcp/omnetpp.ini
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ cmdenv-event-banners = true # for normal (non-express) mode only


**.tcp.delayedAcksEnabled = false # delayed ACK algorithm (RFC 1122) enabled/disabled
**.tcp.nagleEnabled = false # Nagle's algorithm (RFC 896) enabled/disabled
**.tcp.nagleEnabled = false # Nagle's algorithm (RFC 1122) enabled/disabled
**.tcp.limitedTransmitEnabled = false # Limited Transmit algorithm (RFC 3042) enabled/disabled (can be used for TCPReno/TCPTahoe/TCPNewReno/TCPNoCongestionControl)
**.tcp.increasedIWEnabled = false # Increased Initial Window (RFC 3390) enabled/disabled
**.tcp.sackSupport = false # Selective Acknowledgment (RFC 2018, 2883, 3517) support (header option) (SACK will be enabled for a connection if both endpoints support it)
**.tcp.windowScalingSupport = true # Window Scale (RFC 1323) support (header option) (WS will be enabled for a connection if both endpoints support it)
**.tcp.timestampSupport = false # Timestamps (RFC 1323) support (header option) (TS will be enabled for a connection if both endpoints support it)
**.tcp.sackSupport = false # Selective Acknowledgment (RFC 2018, 2883, 6675) support (header option) (SACK will be enabled for a connection if both endpoints support it)
**.tcp.windowScalingSupport = true # Window Scale (RFC 7323) support (header option) (WS will be enabled for a connection if both endpoints support it)
**.tcp.timestampSupport = false # Timestamps (RFC 7323) support (header option) (TS will be enabled for a connection if both endpoints support it)
**.tcp.tcpAlgorithmClass = "DcTcp" # TCPReno/TCPTahoe/TCPNewReno/TCPNoCongestionControl/DumbTCP
**.tcp.advertisedWindow = 350000
**.tcp.mss = 1460
Expand Down
8 changes: 4 additions & 4 deletions examples/inet/redmarker/omnetpp.ini
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ sim-time-limit = 100s

**.tcp.typename = "Tcp"
**.tcp.delayedAcksEnabled = false # delayed ACK algorithm (RFC 1122) enabled/disabled
**.tcp.nagleEnabled = false # Nagle's algorithm (RFC 896) enabled/disabled
**.tcp.nagleEnabled = false # Nagle's algorithm (RFC 1122) enabled/disabled
**.tcp.limitedTransmitEnabled = false # Limited Transmit algorithm (RFC 3042) enabled/disabled (can be used for TCPReno/TCPTahoe/TCPNewReno/TCPNoCongestionControl)
**.tcp.increasedIWEnabled = false # Increased Initial Window (RFC 3390) enabled/disabled
**.tcp.sackSupport = false # Selective Acknowledgment (RFC 2018, 2883, 3517) support (header option) (SACK will be enabled for a connection if both endpoints support it)
**.tcp.windowScalingSupport = true # Window Scale (RFC 1323) support (header option) (WS will be enabled for a connection if both endpoints support it)
**.tcp.timestampSupport = false # Timestamps (RFC 1323) support (header option) (TS will be enabled for a connection if both endpoints support it)
**.tcp.sackSupport = false # Selective Acknowledgment (RFC 2018, 2883, 6675) support (header option) (SACK will be enabled for a connection if both endpoints support it)
**.tcp.windowScalingSupport = true # Window Scale (RFC 7323) support (header option) (WS will be enabled for a connection if both endpoints support it)
**.tcp.timestampSupport = false # Timestamps (RFC 7323) support (header option) (TS will be enabled for a connection if both endpoints support it)
**.tcp.tcpAlgorithmClass = "TcpReno" # TCPReno/TCPTahoe/TCPNewReno/TCPNoCongestionControl/DumbTCP
**.tcp.advertisedWindow = 5000000
**.tcp.mss = 1460
Expand Down
10 changes: 5 additions & 5 deletions examples/inet/tcpwindowscale/omnetpp.ini
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ sim-time-limit = 600.0s
**.tcp.typename = "Tcp"
**.tcp.advertisedWindow = 65535 # in bytes, corresponds with the maximal receiver buffer capacity (Note: normally, NIC queues should be at least this size)
**.tcp.delayedAcksEnabled = false # delayed ACK algorithm (RFC 1122) enabled/disabled
**.tcp.nagleEnabled = true # Nagle's algorithm (RFC 896) enabled/disabled
**.tcp.nagleEnabled = true # Nagle's algorithm (RFC 1122) enabled/disabled
**.tcp.limitedTransmitEnabled = false # Limited Transmit algorithm (RFC 3042) enabled/disabled (can be used for TcpReno/TcpTahoe/TcpNewReno/TcpNoCongestionControl)
**.tcp.increasedIWEnabled = false # Increased Initial Window (RFC 3390) enabled/disabled
**.tcp.sackSupport = false # Selective Acknowledgment (RFC 2018, 2883, 3517) support (header option) (SACK will be enabled for a connection if both endpoints support it)
**.tcp.windowScalingSupport = false # Window Scale (RFC 1323) support (header option) (WS will be enabled for a connection if both endpoints support it)
**.tcp.timestampSupport = false # Timestamps (RFC 1323) support (header option) (TS will be enabled for a connection if both endpoints support it)
**.tcp.mss = 1452 # Maximum Segment Size (RFC 793) (header option)
**.tcp.sackSupport = false # Selective Acknowledgment (RFC 2018, 2883, 6675) support (header option) (SACK will be enabled for a connection if both endpoints support it)
**.tcp.windowScalingSupport = false # Window Scale (RFC 7323) support (header option) (WS will be enabled for a connection if both endpoints support it)
**.tcp.timestampSupport = false # Timestamps (RFC 7323) support (header option) (TS will be enabled for a connection if both endpoints support it)
**.tcp.mss = 1452 # Maximum Segment Size (RFC 9293) (header option)
**.tcp.tcpAlgorithmClass = "TcpReno" # TcpReno/TcpTahoe/TcpNewReno/TcpNoCongestionControl/DumbTcp

#
Expand Down
4 changes: 2 additions & 2 deletions src/inet/applications/tcpapp/TcpAppBase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ void TcpAppBase::close()
emit(connectSignal, -1L);
}

void TcpAppBase::sendPacket(Packet *msg)
void TcpAppBase::sendPacket(Packet *msg, bool eor)
{
int numBytes = msg->getByteLength();
emit(packetSentSignal, msg);
socket.send(msg);
socket.send(msg, eor);

packetsSent++;
bytesSent += numBytes;
Expand Down
2 changes: 1 addition & 1 deletion src/inet/applications/tcpapp/TcpAppBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class INET_API TcpAppBase : public ApplicationBase, public TcpSocket::ICallback
/* Utility functions */
virtual void connect();
virtual void close();
virtual void sendPacket(Packet *pkt);
virtual void sendPacket(Packet *pkt, bool eor = false);

virtual void handleTimer(cMessage *msg) = 0;

Expand Down
26 changes: 20 additions & 6 deletions src/inet/applications/tcpapp/TcpSessionApp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,9 @@ void TcpSessionApp::handleTimer(cMessage *msg)
void TcpSessionApp::sendData()
{
long numBytes = commands[commandIndex].numBytes;
EV_INFO << "sending data with " << numBytes << " bytes\n";
sendPacket(createDataPacket(numBytes));
bool eor = commands[commandIndex].eor;
EV_INFO << "sending data with " << numBytes << " bytes" << (eor ? " (eor)" : "") << "\n";
sendPacket(createDataPacket(numBytes), eor);

if (++commandIndex < (int)commands.size()) {
simtime_t tSend = commands[commandIndex].tSend;
Expand All @@ -148,7 +149,8 @@ Packet *TcpSessionApp::createDataPacket(long sendBytes)
const char *dataTransferMode = par("dataTransferMode");
Ptr<Chunk> payload;
if (!strcmp(dataTransferMode, "bytecount")) {
payload = makeShared<ByteCountChunk>(B(sendBytes));
int packetData = par("packetData");
payload = packetData == -1 ? makeShared<ByteCountChunk>(B(sendBytes)) : makeShared<ByteCountChunk>(B(sendBytes), packetData);
}
else if (!strcmp(dataTransferMode, "object")) {
const auto& applicationPacket = makeShared<ApplicationPacket>();
Expand All @@ -159,8 +161,9 @@ Packet *TcpSessionApp::createDataPacket(long sendBytes)
const auto& bytesChunk = makeShared<BytesChunk>();
std::vector<uint8_t> vec;
vec.resize(sendBytes);
int packetData = par("packetData");
for (int i = 0; i < sendBytes; i++)
vec[i] = (bytesSent + i) & 0xFF;
vec[i] = packetData == -1 ? (bytesSent + i) & 0xFF : packetData;
bytesChunk->setBytes(vec);
payload = bytesChunk;
}
Expand Down Expand Up @@ -236,9 +239,20 @@ void TcpSessionApp::parseScript(const char *script)
while (isdigit(*s))
s++;

// MSG_EOR: optional "eor" keyword right after the byte
// count marks this command's SEND as a record boundary.
while (isspace(*s))
s++;

bool eor = false;
if (strncmp(s, "eor", 3) == 0 && !isalnum(s[3])) {
eor = true;
s += 3;
}

// add command
EV_DEBUG << " add command (" << tSend << "s, " << numBytes << "B)\n";
commands.push_back(Command(tSend, numBytes));
EV_DEBUG << " add command (" << tSend << "s, " << numBytes << "B" << (eor ? ", eor" : "") << ")\n";
commands.push_back(Command(tSend, numBytes, eor));

// skip delimiter
while (isspace(*s))
Expand Down
3 changes: 2 additions & 1 deletion src/inet/applications/tcpapp/TcpSessionApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class INET_API TcpSessionApp : public TcpAppBase
struct Command {
simtime_t tSend;
long numBytes = 0;
Command(simtime_t t, long n) { tSend = t; numBytes = n; }
bool eor = false; // MSG_EOR: "eor" keyword after the byte count in sendScript
Command(simtime_t t, long n, bool e = false) { tSend = t; numBytes = n; eor = e; }
};
typedef std::vector<Command> CommandVector;
CommandVector commands;
Expand Down
6 changes: 5 additions & 1 deletion src/inet/applications/tcpapp/TcpSessionApp.ned
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ import inet.applications.contract.IApp;
// data. One way of specifying sending is via the `tSend`, `sendBytes`
// parameters, the other way is with `sendScript`. With the former, `sendBytes`
// bytes will be sent at `tSend`. With `sendScript`, the format is
// "<time> <numBytes>;<time> <numBytes>;..."
// "<time> <numBytes>[ eor];<time> <numBytes>[ eor];...". The optional trailing
// `eor` keyword marks that SEND's last byte as a record boundary (MSG_EOR):
// TCP will not coalesce it together with data from a later SEND into the same
// outgoing segment.
//
// <b>Closing the connection</b>
//
Expand Down Expand Up @@ -86,6 +89,7 @@ simple TcpSessionApp extends SimpleModule like IApp
string connectAddress;
int connectPort = default(1000);
string dataTransferMode @enum("bytecount","object","bytestream") = default("bytecount");
int packetData = default(-1); // the packet is filled with this byte if not -1
bool autoRead = default(true); // Whether to use "autoread" or "explicit-read" mode for TCP connection
volatile int readSize @unit(B) = default(-1B); // Used only with autoRead==false
volatile double readDelay @unit(s) = default(-1s); // Used only with autoRead==false; delay for issuing a READ command after previous READ was satisfied; -1 means immediately, 0 means zero delay
Expand Down
Loading
Loading