|
INET Framework for OMNeT++/OMNEST
|
Manages a TCP connection.
More...
#include <TcpConnection.h>
|
| TcpSendQueue * | getSendQueue () const |
| |
| TcpReceiveQueue * | getReceiveQueue () const |
| |
| TcpAlgorithm * | getTcpAlgorithm () const |
| |
|
| virtual TcpEventCode | preanalyseAppCommandEvent (int commandCode) |
| | Maps app command codes (msg kind of app command msgs) to TCP_E_xxx event codes. More...
|
| |
| virtual bool | performStateTransition (const TcpEventCode &event) |
| | Implemements the pure TCP state machine. More...
|
| |
| virtual void | stateEntered (int state, int oldState, TcpEventCode event) |
| | Perform cleanup necessary when entering a new state, e.g. More...
|
| |
|
| virtual void | process_OPEN_ACTIVE (TcpEventCode &event, TcpCommand *tcpCommand, cMessage *msg) |
| |
| virtual void | process_OPEN_PASSIVE (TcpEventCode &event, TcpCommand *tcpCommand, cMessage *msg) |
| |
| virtual void | process_ACCEPT (TcpEventCode &event, TcpCommand *tcpCommand, cMessage *msg) |
| |
| virtual void | process_SEND (TcpEventCode &event, TcpCommand *tcpCommand, cMessage *msg) |
| |
| virtual void | process_CLOSE (TcpEventCode &event, TcpCommand *tcpCommand, cMessage *msg) |
| |
| virtual void | process_ABORT (TcpEventCode &event, TcpCommand *tcpCommand, cMessage *msg) |
| |
| virtual void | process_DESTROY (TcpEventCode &event, TcpCommand *tcpCommand, cMessage *msg) |
| |
| virtual void | process_STATUS (TcpEventCode &event, TcpCommand *tcpCommand, cMessage *msg) |
| |
| virtual void | process_QUEUE_BYTES_LIMIT (TcpEventCode &event, TcpCommand *tcpCommand, cMessage *msg) |
| |
| virtual void | process_READ_REQUEST (TcpEventCode &event, TcpCommand *tcpCommand, cMessage *msg) |
| |
| virtual void | process_OPTIONS (TcpEventCode &event, TcpCommand *tcpCommand, cMessage *msg) |
| |
|
| virtual bool | tryFastRoute (const Ptr< const TcpHeader > &tcpHeader) |
| | Shortcut to process most common case as fast as possible. More...
|
| |
| virtual TcpEventCode | process_RCV_SEGMENT (Packet *tcpSegment, const Ptr< const TcpHeader > &tcpHeader, L3Address src, L3Address dest) |
| | Process incoming TCP segment. More...
|
| |
| virtual TcpEventCode | processSegmentInListen (Packet *tcpSegment, const Ptr< const TcpHeader > &tcpHeader, L3Address src, L3Address dest) |
| |
| virtual TcpEventCode | processSynInListen (Packet *tcpSegment, const Ptr< const TcpHeader > &tcpHeader, L3Address srcAddr, L3Address destAddr) |
| |
| virtual TcpEventCode | processSegmentInSynSent (Packet *tcpSegment, const Ptr< const TcpHeader > &tcpHeader, L3Address src, L3Address dest) |
| |
| virtual TcpEventCode | processSegment1stThru8th (Packet *tcpSegment, const Ptr< const TcpHeader > &tcpHeader) |
| |
| virtual TcpEventCode | processRstInSynReceived (const Ptr< const TcpHeader > &tcpHeader) |
| |
| virtual bool | processAckInEstabEtc (Packet *tcpSegment, const Ptr< const TcpHeader > &tcpHeader) |
| |
|
| virtual bool | processMSSOption (const Ptr< const TcpHeader > &tcpHeader, const TcpOptionMaxSegmentSize &option) |
| |
| virtual bool | processWSOption (const Ptr< const TcpHeader > &tcpHeader, const TcpOptionWindowScale &option) |
| |
| virtual bool | processSACKPermittedOption (const Ptr< const TcpHeader > &tcpHeader, const TcpOptionSackPermitted &option) |
| |
| virtual bool | processSACKOption (const Ptr< const TcpHeader > &tcpHeader, const TcpOptionSack &option) |
| |
| virtual bool | processTSOption (const Ptr< const TcpHeader > &tcpHeader, const TcpOptionTimestamp &option) |
| |
|
| virtual void | sendAck () |
| | Utility: send ACK. More...
|
| |
| virtual bool | sendData (uint32_t congestionWindow) |
| | Utility: Send data from sendQueue, at most congestionWindow. More...
|
| |
| virtual bool | sendProbe () |
| | Utility: sends 1 bytes as "probe", called by the "persist" mechanism. More...
|
| |
| virtual void | retransmitOneSegment (bool called_at_rto) |
| | Utility: retransmit one segment from snd_una. More...
|
| |
| virtual void | retransmitData () |
| | Utility: retransmit all from snd_una to snd_max. More...
|
| |
| virtual void | sendRst (uint32_t seqNo) |
| | Utility: sends RST. More...
|
| |
| virtual void | sendRst (uint32_t seq, L3Address src, L3Address dest, int srcPort, int destPort) |
| | Utility: sends RST; does not use connection state. More...
|
| |
| virtual void | sendRstAck (uint32_t seq, uint32_t ack, L3Address src, L3Address dest, int srcPort, int destPort) |
| | Utility: sends RST+ACK; does not use connection state. More...
|
| |
| virtual void | sendFin () |
| | Utility: sends FIN. More...
|
| |
| virtual uint32_t | sendSegment (uint32_t bytes) |
| | Utility: sends one segment of 'bytes' bytes from snd_nxt, and advances snd_nxt. More...
|
| |
| virtual void | sendToIP (Packet *tcpSegment, const Ptr< TcpHeader > &tcpHeader) |
| | Utility: adds control info to segment and sends it to IP. More...
|
| |
| virtual void | startSynRexmitTimer () |
| | Utility: start SYN-REXMIT timer. More...
|
| |
| virtual void | signalConnectionTimeout () |
| | Utility: signal to user that connection timed out. More...
|
| |
| virtual void | printConnBrief () const |
| | Utility: prints local/remote addr/port and app gate index/socketId. More...
|
| |
| virtual void | updateRcvQueueVars () |
| | Utility: update receiver queue related variables and statistics - called before setting rcv_wnd. More...
|
| |
| virtual bool | hasEnoughSpaceForSegmentInReceiveQueue (Packet *tcpSegment, const Ptr< const TcpHeader > &tcpHeader) |
| | Utility: returns true when receive queue has enough space for store the tcpHeader. More...
|
| |
| virtual unsigned short | updateRcvWnd () |
| | Utility: update receive window (rcv_wnd), and calculate scaled value if window scaling enabled. More...
|
| |
| virtual void | updateWndInfo (const Ptr< const TcpHeader > &tcpHeader, bool doAlways=false) |
| | Utility: update window information (snd_wnd, snd_wl1, snd_wl2) More...
|
| |
| | TcpConnection () |
| |
| | TcpConnection (const TcpConnection &other) |
| |
| void | initialize () |
| |
| void | initConnection (Tcp *mod, int socketId) |
| | The "normal" constructor. More...
|
| |
| virtual | ~TcpConnection () |
| | Destructor. More...
|
| |
| int | getLocalPort () const |
| |
| L3Address | getLocalAddress () const |
| |
| int | getRemotePort () const |
| |
| L3Address | getRemoteAddress () const |
| |
| virtual void | segmentArrivalWhileClosed (Packet *tcpSegment, const Ptr< const TcpHeader > &tcpHeader, L3Address src, L3Address dest) |
| | This method gets invoked from TCP when a segment arrives which doesn't belong to an existing connection. More...
|
| |
| virtual void | process_TIMEOUT_2MSL () |
| |
| virtual void | process_TIMEOUT_CONN_ESTAB () |
| |
| virtual void | process_TIMEOUT_FIN_WAIT_2 () |
| |
| virtual void | process_TIMEOUT_SYN_REXMIT (TcpEventCode &event) |
| |
| virtual TcpConnection * | cloneListeningConnection () |
| | Utility: clone a listening connection. More...
|
| |
| virtual void | initClonedConnection (TcpConnection *listenerConn) |
| |
| virtual void | initConnection (TcpOpenCommand *openCmd) |
| | Utility: creates send/receive queues and tcpAlgorithm. More...
|
| |
| virtual void | configureStateVariables () |
| | Utility: set snd_mss, rcv_wnd and sack in newly created state variables block. More...
|
| |
| virtual void | selectInitialSeqNum () |
| | Utility: generates ISS and initializes corresponding state variables. More...
|
| |
| virtual bool | isSegmentAcceptable (Packet *tcpSegment, const Ptr< const TcpHeader > &tcpHeader) const |
| | Utility: check if segment is acceptable (all bytes are in receive window) More...
|
| |
| virtual void | sendSyn () |
| | Utility: send SYN. More...
|
| |
| virtual void | sendSynAck () |
| | Utility: send SYN+ACK. More...
|
| |
| virtual void | readHeaderOptions (const Ptr< const TcpHeader > &tcpHeader) |
| | Utility: readHeaderOptions (Currently only EOL, NOP, MSS, WS, SACK_PERMITTED, SACK and TS are implemented) More...
|
| |
| virtual TcpHeader | writeHeaderOptions (const Ptr< TcpHeader > &tcpHeader) |
| | Utility: writeHeaderOptions (Currently only EOL, NOP, MSS, WS, SACK_PERMITTED, SACK and TS are implemented) More...
|
| |
| virtual TcpHeader | addSacks (const Ptr< TcpHeader > &tcpHeader) |
| | Utility: adds SACKs to segments header options field. More...
|
| |
| virtual uint32_t | getTSval (const Ptr< const TcpHeader > &tcpHeader) const |
| | Utility: get TSval from segments TS header option. More...
|
| |
| virtual uint32_t | getTSecr (const Ptr< const TcpHeader > &tcpHeader) const |
| | Utility: get TSecr from segments TS header option. More...
|
| |
| virtual bool | isToBeAccepted () const |
| | Utility: returns true if the connection is not yet accepted by the application. More...
|
| |
| virtual void | sendToIP (Packet *pkt, const Ptr< TcpHeader > &tcpHeader, L3Address src, L3Address dest) |
| | Utility: send IP packet. More...
|
| |
| virtual void | sendToApp (cMessage *msg) |
| | Utility: sends packet to application. More...
|
| |
| virtual void | sendIndicationToApp (int code, const int id=0) |
| | Utility: sends status indication (TCP_I_xxx) to application. More...
|
| |
| virtual void | sendAvailableIndicationToApp () |
| | Utility: sends TCP_I_AVAILABLE indication with TcpAvailableInfo to application. More...
|
| |
| virtual void | sendEstabIndicationToApp () |
| | Utility: sends TCP_I_ESTABLISHED indication with TcpConnectInfo to application. More...
|
| |
| virtual void | sendAvailableDataToApp () |
| | Utility: sends data or data notification to application. More...
|
| |
| static void | printSegmentBrief (Packet *tcpSegment, const Ptr< const TcpHeader > &tcpHeader) |
| | Utility: prints important header fields. More...
|
| |
| static const char * | stateName (int state) |
| | Utility: returns name of TCP_S_xxx constants. More...
|
| |
| static const char * | eventName (int event) |
| | Utility: returns name of TCP_E_xxx constants. More...
|
| |
| static const char * | indicationName (int code) |
| | Utility: returns name of TCP_I_xxx constants. More...
|
| |
| static const char * | optionName (int option) |
| | Utility: returns name of TCPOPTION_xxx constants. More...
|
| |
Manages a TCP connection.
This class itself implements the TCP state machine as well as handling control PDUs (SYN, SYN+ACK, RST, FIN, etc.), timers (2MSL, CONN-ESTAB, FIN-WAIT-2) and events (OPEN, SEND, etc) associated with TCP state changes.
The implementation largely follows the functional specification at the end of RFC 793. Code comments extensively quote RFC 793 to make it easier to understand.
TcpConnection objects are not used alone – they are instantiated and managed by a TCP module.
TcpConnection "outsources" several tasks to objects subclassed from TcpSendQueue, TcpReceiveQueue and TcpAlgorithm; see overview of this with TCP documentation.
Connection variables (TCB) are kept in TcpStateVariables. TcpAlgorithm implementations can extend TcpStateVariables to add their own stuff (see TcpAlgorithm::createStateVariables() factory method.)
The "entry points" of TCPConnnection from TCP are:
All three methods follow a common structure:
- dispatch to specific methods. For example, processAppCommand() invokes one of process_OPEN_ACTIVE(), process_OPEN_PASSIVE() or process_SEND(), etc., and processTCPSegment() dispatches to processSegmentInListen(), processSegmentInSynSent() or processSegment1stThru8th(). Those methods will do the REAL JOB.
- after they return, we'll know the state machine event (TcpEventCode, TCP_E_xxx) for sure, so we can:
- invoke performStateTransition() which executes the necessary state transition (for example, TCP_E_RCV_SYN will take the state machine from TCP_S_LISTEN to TCP_S_SYN_RCVD). No other actions are taken in this step.
- if there was a state change (for example, we entered the TCP_S_ESTABLISHED state), performStateTransition() invokes stateEntered(), which performs some necessary housekeeping (cancel the CONN-ESTAB timer).
When the CLOSED state is reached, TCP will delete the TcpConnection object.
◆ TcpConnection() [1/2]
| inet::tcp::TcpConnection::TcpConnection |
( |
| ) |
|
|
inline |
◆ TcpConnection() [2/2]
| inet::tcp::TcpConnection::TcpConnection |
( |
const TcpConnection & |
other | ) |
|
|
inline |
◆ ~TcpConnection()
| inet::tcp::TcpConnection::~TcpConnection |
( |
| ) |
|
|
virtual |
◆ addSacks()
Utility: adds SACKs to segments header options field.
432 B options_len =
B(0);
433 B used_options_len = tcpHeader->getHeaderOptionArrayLength();
434 bool dsack_inserted =
false;
441 EV_INFO <<
"Previous status of sacks_array: \n" << ((it !=
state->
sacks_array.end()) ?
"" :
"\t EMPTY\n");
445 EV_DETAIL <<
"\t SACK in sacks_array: " <<
" " << it->str() <<
" delete now\n";
449 EV_DETAIL <<
"\t SACK in sacks_array: " <<
" " << it->str() << endl;
458 EV_ERROR <<
"ERROR: Failed to addSacks - at least 10 free bytes needed for SACK - used_options_len=" << used_options_len << endl;
478 dsack_inserted =
true;
479 Sack nSack(start, end);
481 EV_DETAIL <<
"inserted DSACK entry: " << nSack.str() <<
"\n";
487 Sack newSack(contStart, contEnd);
489 EV_DETAIL <<
"Inserted SACK entry: " << newSack.str() <<
"\n";
533 ASSERT(!it->empty());
538 if (it->contains(*it2)) {
539 EV_DETAIL <<
"sack matched, delete contained : a=" << it->str() <<
", b=" << it2->str() << endl;
568 uint optArrSize = tcpHeader->getHeaderOptionArraySize();
570 uint optArrSizeAligned = optArrSize;
572 while (
B(used_options_len).get() % 4 != 2) {
577 while (optArrSize < optArrSizeAligned) {
578 tcpHeader->appendHeaderOption(
new TcpOptionNop());
582 ASSERT(
B(used_options_len).get() % 4 == 2);
584 TcpOptionSack *option =
new TcpOptionSack();
585 option->setLength(8 * n + 2);
586 option->setSackItemArraySize(n);
592 ASSERT(it->getStart() != it->getEnd());
593 option->setSackItem(counter++, *it);
601 tcpHeader->appendHeaderOption(option);
603 tcpHeader->setChunkLength(tcpHeader->getHeaderLength());
609 EV_INFO << n <<
" SACK(s) added to header:\n";
611 for (
uint t = 0; t < n; t++) {
612 EV_INFO << t <<
". SACK:" <<
" [" << option->getSackItem(t).getStart() <<
".." << option->getSackItem(t).getEnd() <<
")";
616 EV_INFO <<
" (D-SACK)";
618 EV_INFO <<
" (received segment filled out a gap)";
Referenced by writeHeaderOptions().
◆ cloneListeningConnection()
| TcpConnection * inet::tcp::TcpConnection::cloneListeningConnection |
( |
| ) |
|
|
protectedvirtual |
Utility: clone a listening connection.
Used for forking.
236 auto moduleType = cModuleType::get(
"inet.transportlayer.tcp.TcpConnection");
237 int newSocketId = getEnvir()->getUniqueNumber();
238 char submoduleName[24];
239 sprintf(submoduleName,
"conn-%d", newSocketId);
240 auto conn = check_and_cast<TcpConnection *>(moduleType->createScheduleInit(submoduleName,
tcpMain));
241 conn->initConnection(
tcpMain, newSocketId);
242 conn->initClonedConnection(
this);
Referenced by processSegmentInListen().
◆ configureStateVariables()
| void inet::tcp::TcpConnection::configureStateVariables |
( |
| ) |
|
|
protectedvirtual |
Utility: set snd_mss, rcv_wnd and sack in newly created state variables block.
439 long advertisedWindowPar =
tcpMain->par(
"advertisedWindow");
444 throw cRuntimeError(
"Invalid advertisedWindow parameter: %ld", advertisedWindowPar);
464 std::string algorithmName1 =
"TcpReno";
465 std::string algorithmName2 =
tcpMain->par(
"tcpAlgorithmClass");
467 if (algorithmName1 != algorithmName2) {
468 EV_DEBUG <<
"If you want to use TCP SACK please set tcpAlgorithmClass to TcpReno\n";
Referenced by initClonedConnection(), and initConnection().
◆ convertSimtimeToTS()
| uint32_t inet::tcp::TcpConnection::convertSimtimeToTS |
( |
simtime_t |
simtime | ) |
|
|
static |
◆ convertTSToSimtime()
| simtime_t inet::tcp::TcpConnection::convertTSToSimtime |
( |
uint32_t |
timestamp | ) |
|
|
static |
◆ eventName()
| const char * inet::tcp::TcpConnection::eventName |
( |
int |
event | ) |
|
|
static |
◆ getFsmState()
| int inet::tcp::TcpConnection::getFsmState |
( |
| ) |
const |
|
inline |
◆ getListeningSocketId()
| int inet::tcp::TcpConnection::getListeningSocketId |
( |
| ) |
const |
|
inline |
◆ getLocalAddr()
| const L3Address& inet::tcp::TcpConnection::getLocalAddr |
( |
| ) |
const |
|
inline |
◆ getLocalAddress()
| L3Address inet::tcp::TcpConnection::getLocalAddress |
( |
| ) |
const |
|
inline |
◆ getLocalPort()
| int inet::tcp::TcpConnection::getLocalPort |
( |
| ) |
const |
|
inline |
◆ getReceiveQueue() [1/2]
◆ getReceiveQueue() [2/2]
◆ getRemoteAddr()
| const L3Address& inet::tcp::TcpConnection::getRemoteAddr |
( |
| ) |
const |
|
inline |
◆ getRemoteAddress()
| L3Address inet::tcp::TcpConnection::getRemoteAddress |
( |
| ) |
const |
|
inline |
◆ getRemotePort()
| int inet::tcp::TcpConnection::getRemotePort |
( |
| ) |
const |
|
inline |
◆ getRexmitQueue() [1/2]
◆ getRexmitQueue() [2/2]
◆ getSendQueue() [1/2]
◆ getSendQueue() [2/2]
| TcpSendQueue* inet::tcp::TcpConnection::getSendQueue |
( |
| ) |
const |
|
inlineprotected |
◆ getSocketId()
| int inet::tcp::TcpConnection::getSocketId |
( |
| ) |
const |
|
inline |
◆ getState() [1/2]
◆ getState() [2/2]
◆ getTcpAlgorithm() [1/2]
◆ getTcpAlgorithm() [2/2]
| TcpAlgorithm* inet::tcp::TcpConnection::getTcpAlgorithm |
( |
| ) |
const |
|
inlineprotected |
◆ getTcpMain()
| Tcp* inet::tcp::TcpConnection::getTcpMain |
( |
| ) |
|
|
inline |
◆ getTSecr()
| uint32_t inet::tcp::TcpConnection::getTSecr |
( |
const Ptr< const TcpHeader > & |
tcpHeader | ) |
const |
|
protectedvirtual |
Utility: get TSecr from segments TS header option.
1417 for (
uint i = 0; i < tcpHeader->getHeaderOptionArraySize(); i++) {
1418 const TcpOption *option = tcpHeader->getHeaderOption(i);
1420 return check_and_cast<const TcpOptionTimestamp *>(option)->getEchoedTimestamp();
Referenced by processAckInEstabEtc().
◆ getTSval()
| uint32_t inet::tcp::TcpConnection::getTSval |
( |
const Ptr< const TcpHeader > & |
tcpHeader | ) |
const |
|
protectedvirtual |
Utility: get TSval from segments TS header option.
1406 for (
uint i = 0; i < tcpHeader->getHeaderOptionArraySize(); i++) {
1407 const TcpOption *option = tcpHeader->getHeaderOption(i);
1409 return check_and_cast<const TcpOptionTimestamp *>(option)->getSenderTimestamp();
Referenced by processSegment1stThru8th().
◆ handleMessage()
| void inet::tcp::TcpConnection::handleMessage |
( |
cMessage * |
msg | ) |
|
|
virtual |
241 if (msg->isSelfMessage()) {
246 throw cRuntimeError(
"model error: TcpConnection allows only self messages");
◆ hasEnoughSpaceForSegmentInReceiveQueue()
| bool inet::tcp::TcpConnection::hasEnoughSpaceForSegmentInReceiveQueue |
( |
Packet * |
tcpSegment, |
|
|
const Ptr< const TcpHeader > & |
tcpHeader |
|
) |
| |
|
virtual |
Utility: returns true when receive queue has enough space for store the tcpHeader.
114 long int payloadLength = tcpSegment->getByteLength() -
B(tcpHeader->getHeaderLength()).get();
115 uint32_t payloadSeq = tcpHeader->getSequenceNo();
117 if (
seqLess(payloadSeq, firstSeq)) {
118 long delta = firstSeq - payloadSeq;
120 payloadLength -= delta;
Referenced by processSegment1stThru8th(), processSegmentInSynSent(), and processSynInListen().
◆ indicationName()
| const char * inet::tcp::TcpConnection::indicationName |
( |
int |
code | ) |
|
|
static |
◆ initClonedConnection()
| void inet::tcp::TcpConnection::initClonedConnection |
( |
TcpConnection * |
listenerConn | ) |
|
|
protectedvirtual |
206 const char *sendQueueClass = listenerConn->sendQueue->getClassName();
210 const char *receiveQueueClass = listenerConn->receiveQueue->getClassName();
218 const char *tcpAlgorithmClass = listenerConn->tcpAlgorithm->getClassName();
◆ initConnection() [1/2]
| void inet::tcp::TcpConnection::initConnection |
( |
Tcp * |
mod, |
|
|
int |
socketId |
|
) |
| |
The "normal" constructor.
205 fsm.setName(getName());
◆ initConnection() [2/2]
| void inet::tcp::TcpConnection::initConnection |
( |
TcpOpenCommand * |
openCmd | ) |
|
|
protectedvirtual |
Utility: creates send/receive queues and tcpAlgorithm.
422 const char *tcpAlgorithmClass = openCmd->getTcpAlgorithmClass();
424 if (opp_isempty(tcpAlgorithmClass))
425 tcpAlgorithmClass =
tcpMain->par(
"tcpAlgorithmClass");
Referenced by process_OPEN_ACTIVE(), and process_OPEN_PASSIVE().
◆ initialize()
| void inet::tcp::TcpConnection::initialize |
( |
| ) |
|
|
inline |
◆ isLost()
| bool inet::tcp::TcpConnection::isLost |
( |
uint32_t |
seqNum | ) |
|
|
virtual |
For SACK TCP.
RFC 3517, page 3: "This routine returns whether the given sequence number is considered to be lost. The routine returns true when either DupThresh discontiguous SACKed sequences have arrived above 'SeqNum' or (DupThresh * SMSS) bytes with sequence numbers greater than 'SeqNum' have been SACKed. Otherwise, the routine returns false."
Referenced by nextSeg(), and setPipe().
◆ isSegmentAcceptable()
| bool inet::tcp::TcpConnection::isSegmentAcceptable |
( |
Packet * |
tcpSegment, |
|
|
const Ptr< const TcpHeader > & |
tcpHeader |
|
) |
| const |
|
protectedvirtual |
Utility: check if segment is acceptable (all bytes are in receive window)
499 uint32_t len = tcpSegment->getByteLength() -
B(tcpHeader->getHeaderLength()).get();
500 uint32_t seqNo = tcpHeader->getSequenceNo();
501 uint32_t ackNo = tcpHeader->getAckNo();
524 if (!ret && len == 0) {
532 EV_WARN <<
"Not Acceptable segment. seqNo=" << seqNo <<
" ackNo=" << ackNo <<
" len=" << len <<
" rcv_nxt="
Referenced by processSegment1stThru8th().
◆ isSendQueueEmpty()
| bool inet::tcp::TcpConnection::isSendQueueEmpty |
( |
| ) |
|
|
virtual |
◆ isToBeAccepted()
| virtual bool inet::tcp::TcpConnection::isToBeAccepted |
( |
| ) |
const |
|
inlineprotectedvirtual |
◆ nextSeg()
| bool inet::tcp::TcpConnection::nextSeg |
( |
uint32_t & |
seqNum | ) |
|
|
virtual |
For SACK TCP.
RFC 3517, page 3: "This routine uses the scoreboard data structure maintained by the Update() function to determine what to transmit based on the SACK information that has arrived from the data receiver (and hence been marked in the scoreboard). NextSeg () MUST return the sequence number range of the next segment that is to be transmitted..." Returns true if a valid sequence number (for the next segment) is found and returns false if no segment should be send.
223 bool rexmitted =
false;
270 uint32_t effectiveWin = maxWindow -
state->
pipe;
Referenced by sendDataDuringLossRecoveryPhase().
◆ optionName()
| const char * inet::tcp::TcpConnection::optionName |
( |
int |
option | ) |
|
|
static |
◆ performStateTransition()
| bool inet::tcp::TcpConnection::performStateTransition |
( |
const TcpEventCode & |
event | ) |
|
|
protectedvirtual |
◆ preanalyseAppCommandEvent()
| TcpEventCode inet::tcp::TcpConnection::preanalyseAppCommandEvent |
( |
int |
commandCode | ) |
|
|
protectedvirtual |
Maps app command codes (msg kind of app command msgs) to TCP_E_xxx event codes.
375 switch (commandCode) {
410 throw cRuntimeError(
tcpMain,
"Unknown message kind in app command");
Referenced by processAppCommand().
◆ printConnBrief()
| void inet::tcp::TcpConnection::printConnBrief |
( |
| ) |
const |
|
virtual |
◆ printSegmentBrief()
| void inet::tcp::TcpConnection::printSegmentBrief |
( |
Packet * |
tcpSegment, |
|
|
const Ptr< const TcpHeader > & |
tcpHeader |
|
) |
| |
|
static |
Utility: prints important header fields.
159 EV_INFO <<
"." << tcpHeader->getSrcPort() <<
" > ";
160 EV_INFO <<
"." << tcpHeader->getDestPort() <<
": ";
162 if (tcpHeader->getSynBit())
163 EV_INFO << (tcpHeader->getAckBit() ?
"SYN+ACK " :
"SYN ");
165 if (tcpHeader->getFinBit())
166 EV_INFO <<
"FIN(+ACK) ";
168 if (tcpHeader->getRstBit())
169 EV_INFO << (tcpHeader->getAckBit() ?
"RST+ACK " :
"RST ");
171 if (tcpHeader->getPshBit())
174 auto payloadLength = tcpSegment->getByteLength() -
B(tcpHeader->getHeaderLength()).get();
175 if (payloadLength > 0 || tcpHeader->getSynBit()) {
176 EV_INFO <<
"[" << tcpHeader->getSequenceNo() <<
".." << (tcpHeader->getSequenceNo() + payloadLength) <<
") ";
177 EV_INFO <<
"(l=" << payloadLength <<
") ";
180 if (tcpHeader->getAckBit())
181 EV_INFO <<
"ack " << tcpHeader->getAckNo() <<
" ";
183 EV_INFO <<
"win " << tcpHeader->getWindow() <<
" ";
185 if (tcpHeader->getUrgBit())
186 EV_INFO <<
"urg " << tcpHeader->getUrgentPointer() <<
" ";
189 EV_INFO <<
"options ";
191 for (
uint i = 0; i < tcpHeader->getHeaderOptionArraySize(); i++) {
192 const TcpOption *option = tcpHeader->getHeaderOption(i);
193 short kind = option->getKind();
Referenced by process_RCV_SEGMENT(), segmentArrivalWhileClosed(), and sendToIP().
◆ process_ABORT()
| void inet::tcp::TcpConnection::process_ABORT |
( |
TcpEventCode & |
event, |
|
|
TcpCommand * |
tcpCommand, |
|
|
cMessage * |
msg |
|
) |
| |
|
protectedvirtual |
257 switch (
fsm.getState()) {
259 throw cRuntimeError(
"Error processing command ABORT: connection not open");
Referenced by processAppCommand().
◆ process_ACCEPT()
| void inet::tcp::TcpConnection::process_ACCEPT |
( |
TcpEventCode & |
event, |
|
|
TcpCommand * |
tcpCommand, |
|
|
cMessage * |
msg |
|
) |
| |
|
protectedvirtual |
104 TcpAcceptCommand *acceptCommand = check_and_cast<TcpAcceptCommand *>(tcpCommand);
108 delete acceptCommand;
Referenced by processAppCommand().
◆ process_CLOSE()
| void inet::tcp::TcpConnection::process_CLOSE |
( |
TcpEventCode & |
event, |
|
|
TcpCommand * |
tcpCommand, |
|
|
cMessage * |
msg |
|
) |
| |
|
protectedvirtual |
195 switch (
fsm.getState()) {
217 EV_DETAIL <<
"No outstanding SENDs, sending FIN right away, advancing snd_nxt over the FIN\n";
229 <<
" bytes pending, deferring sending of FIN\n";
243 throw cRuntimeError(
tcpMain,
"Duplicate CLOSE command: connection already closing");
Referenced by processAppCommand().
◆ process_DESTROY()
| void inet::tcp::TcpConnection::process_DESTROY |
( |
TcpEventCode & |
event, |
|
|
TcpCommand * |
tcpCommand, |
|
|
cMessage * |
msg |
|
) |
| |
|
protectedvirtual |
◆ process_OPEN_ACTIVE()
| void inet::tcp::TcpConnection::process_OPEN_ACTIVE |
( |
TcpEventCode & |
event, |
|
|
TcpCommand * |
tcpCommand, |
|
|
cMessage * |
msg |
|
) |
| |
|
protectedvirtual |
28 TcpOpenCommand *openCmd = check_and_cast<TcpOpenCommand *>(tcpCommand);
32 switch (
fsm.getState()) {
44 throw cRuntimeError(
tcpMain,
"Error processing command OPEN_ACTIVE: remote address and port must be specified");
48 EV_DETAIL <<
"Assigned ephemeral port " <<
localPort <<
"\n";
63 throw cRuntimeError(
tcpMain,
"Error processing command OPEN_ACTIVE: connection already exists");
Referenced by processAppCommand().
◆ process_OPEN_PASSIVE()
| void inet::tcp::TcpConnection::process_OPEN_PASSIVE |
( |
TcpEventCode & |
event, |
|
|
TcpCommand * |
tcpCommand, |
|
|
cMessage * |
msg |
|
) |
| |
|
protectedvirtual |
72 TcpOpenCommand *openCmd = check_and_cast<TcpOpenCommand *>(tcpCommand);
76 switch (
fsm.getState()) {
87 throw cRuntimeError(
tcpMain,
"Error processing command OPEN_PASSIVE: local port must be specified");
95 throw cRuntimeError(
tcpMain,
"Error processing command OPEN_PASSIVE: connection already exists");
Referenced by processAppCommand().
◆ process_OPTIONS()
| void inet::tcp::TcpConnection::process_OPTIONS |
( |
TcpEventCode & |
event, |
|
|
TcpCommand * |
tcpCommand, |
|
|
cMessage * |
msg |
|
) |
| |
|
protectedvirtual |
176 if (
auto cmd =
dynamic_cast<TcpSetTimeToLiveCommand *
>(tcpCommand))
178 else if (
auto cmd =
dynamic_cast<TcpSetTosCommand *
>(tcpCommand)) {
181 else if (
auto cmd =
dynamic_cast<TcpSetDscpCommand *
>(tcpCommand)) {
182 dscp = cmd->getDscp();
185 throw cRuntimeError(
"Unknown subclass of TcpSetOptionCommand received from app: %s", tcpCommand->getClassName());
Referenced by processAppCommand().
◆ process_QUEUE_BYTES_LIMIT()
| void inet::tcp::TcpConnection::process_QUEUE_BYTES_LIMIT |
( |
TcpEventCode & |
event, |
|
|
TcpCommand * |
tcpCommand, |
|
|
cMessage * |
msg |
|
) |
| |
|
protectedvirtual |
322 if (
state ==
nullptr)
323 throw cRuntimeError(
"Called process_QUEUE_BYTES_LIMIT on uninitialized TcpConnection!");
Referenced by processAppCommand().
◆ process_RCV_SEGMENT()
Process incoming TCP segment.
Returns a specific event code (e.g. TCP_E_RCV_SYN) which will drive the state machine.
80 EV_INFO <<
"Seg arrived: ";
82 EV_DETAIL <<
"TCB: " <<
state->
str() <<
"\n";
Referenced by processTCPSegment().
◆ process_READ_REQUEST()
| void inet::tcp::TcpConnection::process_READ_REQUEST |
( |
TcpEventCode & |
event, |
|
|
TcpCommand * |
tcpCommand, |
|
|
cMessage * |
msg |
|
) |
| |
|
protectedvirtual |
◆ process_SEND()
116 Packet *packet = check_and_cast<Packet *>(msg);
117 switch (
fsm.getState()) {
119 throw cRuntimeError(
tcpMain,
"Error processing command SEND: connection not open");
122 EV_DETAIL <<
"SEND command turns passive open into active open, sending initial SYN\n";
134 EV_DETAIL <<
"Queueing up data for sending later.\n";
152 throw cRuntimeError(
tcpMain,
"Error processing command SEND: connection closing");
Referenced by processAppCommand().
◆ process_STATUS()
| void inet::tcp::TcpConnection::process_STATUS |
( |
TcpEventCode & |
event, |
|
|
TcpCommand * |
tcpCommand, |
|
|
cMessage * |
msg |
|
) |
| |
|
protectedvirtual |
288 throw cRuntimeError(
"Error processing command STATUS: connection not open");
290 TcpStatusInfo *statusInfo =
new TcpStatusInfo();
292 statusInfo->setState(
fsm.getState());
315 msg->setControlInfo(statusInfo);
Referenced by processAppCommand().
◆ process_TIMEOUT_2MSL()
| void inet::tcp::TcpConnection::process_TIMEOUT_2MSL |
( |
| ) |
|
|
protectedvirtual |
1301 switch (
fsm.getState()) {
1312 "Internal error: received time-wait (2MSL) timeout in state %s",
Referenced by processTimer().
◆ process_TIMEOUT_CONN_ESTAB()
| void inet::tcp::TcpConnection::process_TIMEOUT_CONN_ESTAB |
( |
| ) |
|
|
protectedvirtual |
1277 switch (
fsm.getState()) {
1290 throw cRuntimeError(
tcpMain,
"Internal error: received CONN_ESTAB timeout in state %s",
Referenced by processTimer().
◆ process_TIMEOUT_FIN_WAIT_2()
| void inet::tcp::TcpConnection::process_TIMEOUT_FIN_WAIT_2 |
( |
| ) |
|
|
protectedvirtual |
1319 switch (
fsm.getState()) {
1327 throw cRuntimeError(
tcpMain,
"Internal error: received FIN_WAIT_2 timeout in state %s",
Referenced by processTimer().
◆ process_TIMEOUT_SYN_REXMIT()
| void inet::tcp::TcpConnection::process_TIMEOUT_SYN_REXMIT |
( |
TcpEventCode & |
event | ) |
|
|
protectedvirtual |
1342 EV_INFO <<
"Retransmission count during connection setup exceeds " <<
MAX_SYN_REXMIT_COUNT <<
", giving up\n";
1351 switch (
fsm.getState()) {
1361 throw cRuntimeError(
tcpMain,
"Internal error: SYN-REXMIT timer expired while in state %s",
Referenced by processTimer().
◆ processAckInEstabEtc()
| bool inet::tcp::TcpConnection::processAckInEstabEtc |
( |
Packet * |
tcpSegment, |
|
|
const Ptr< const TcpHeader > & |
tcpHeader |
|
) |
| |
|
protectedvirtual |
1129 EV_DETAIL <<
"Processing ACK in a data transfer state\n";
1131 int payloadLength = tcpSegment->getByteLength() -
B(tcpHeader->getHeaderLength()).get();
1136 if (tcpHeader->getEceBit() ==
true)
1137 EV_INFO <<
"Received packet with ECE\n";
1192 if (payloadLength == 0) {
1194 EV_DETAIL <<
"Old ACK: ackNo < snd_una\n";
1196 EV_DETAIL <<
"ACK looks duplicate but we have currently no unacked data (snd_una == snd_max)\n";
1232 EV_DETAIL <<
"ACK acks our FIN\n";
Referenced by processSegment1stThru8th().
◆ processAppCommand()
| bool inet::tcp::TcpConnection::processAppCommand |
( |
cMessage * |
msg | ) |
|
|
virtual |
Process commands from the application.
Normally returns true. A return value of false means that the connection structure must be deleted by the caller (TCP).
316 TcpCommand *tcpCommand = check_and_cast_nullable<TcpCommand *>(msg->removeControlInfo());
318 EV_INFO <<
"App command: " <<
eventName(event) <<
"\n";
366 throw cRuntimeError(
tcpMain,
"wrong event code");
Referenced by inet::tcp::Tcp::handleUpperCommand().
◆ processMSSOption()
1116 if (option.getLength() != 4) {
1117 EV_ERROR <<
"ERROR: MSS option length incorrect\n";
1122 EV_ERROR <<
"ERROR: Tcp Header Option MSS received, but in unexpected state\n";
1145 EV_INFO <<
"Tcp Header Option MSS(=" << option.getMaxSegmentSize() <<
") received, SMSS is set to " <<
state->
snd_mss <<
"\n";
Referenced by readHeaderOptions().
◆ processRstInSynReceived()
| TcpEventCode inet::tcp::TcpConnection::processRstInSynReceived |
( |
const Ptr< const TcpHeader > & |
tcpHeader | ) |
|
|
protectedvirtual |
◆ processSACKOption()
| bool inet::tcp::TcpConnection::processSACKOption |
( |
const Ptr< const TcpHeader > & |
tcpHeader, |
|
|
const TcpOptionSack & |
option |
|
) |
| |
|
protectedvirtual |
31 if (option.getLength() % 8 != 2) {
32 EV_ERROR <<
"ERROR: option length incorrect\n";
36 uint n = option.getSackItemArraySize();
37 ASSERT(option.getLength() == 2 + n * 8);
40 EV_ERROR <<
"ERROR: " << n <<
" SACK(s) received, but sack_enabled is set to false\n";
47 EV_ERROR <<
"ERROR: Tcp Header Option SACK received, but in unexpected state\n";
52 EV_INFO << n <<
" SACK(s) received:\n";
53 for (
uint i = 0; i < n; i++) {
55 tmp.setStart(option.getSackItem(i).getStart());
56 tmp.setEnd(option.getSackItem(i).getEnd());
58 EV_INFO << (i + 1) <<
". SACK: " << tmp.str() << endl;
61 if (i == 0 &&
seqLE(tmp.getEnd(), tcpHeader->getAckNo())) {
73 EV_DETAIL <<
"Received D-SACK below cumulative ACK=" << tcpHeader->getAckNo()
74 <<
" D-SACK: " << tmp.str() << endl;
82 else if (i == 0 && n > 1 &&
seqGreater(tmp.getEnd(), tcpHeader->getAckNo())) {
90 Sack tmp2(option.getSackItem(1).getStart(), option.getSackItem(1).getEnd());
92 if (tmp2.contains(tmp)) {
93 EV_DETAIL <<
"Received D-SACK above cumulative ACK=" << tcpHeader->getAckNo()
94 <<
" D-SACK: " << tmp.str()
95 <<
", SACK: " << tmp2.str() << endl;
108 EV_DETAIL <<
"Received SACK below total cumulative ACK snd_una=" <<
state->
snd_una <<
"\n";
Referenced by readHeaderOptions().
◆ processSACKPermittedOption()
1224 if (option.getLength() != 2) {
1225 EV_ERROR <<
"ERROR: length incorrect\n";
1230 EV_ERROR <<
"ERROR: Tcp Header Option SACK_PERMITTED received, but in unexpected state\n";
1236 EV_INFO <<
"Tcp Header Option SACK_PERMITTED received, SACK (sack_enabled) is set to " <<
state->
sack_enabled <<
"\n";
Referenced by readHeaderOptions().
◆ processSegment1stThru8th()
135 bool acceptable =
true;
140 uint32_t tsval =
getTSval(tcpHeader);
144 EV_DETAIL <<
"PAWS: Segment is not acceptable, TSval=" << tsval <<
" in "
145 <<
stateName(
fsm.getState()) <<
" state received: dropping segment\n";
156 int payloadLength = tcpSegment->getByteLength() -
B(tcpHeader->getHeaderLength()).get();
166 if (tcpHeader->getRstBit()) {
167 EV_DETAIL <<
"RST with unacceptable seqNum: dropping\n";
170 if (tcpHeader->getSynBit()) {
171 EV_DETAIL <<
"SYN with unacceptable seqNum in " <<
stateName(
fsm.getState()) <<
" state received (SYN duplicat?)\n";
177 EV_DETAIL <<
"SND_D-SACK SET (dupseg rcvd)\n";
180 EV_DETAIL <<
"Segment seqNum not acceptable, sending ACK with current receive seq\n";
198 if (tcpHeader->getCwrBit() ==
true) {
199 EV_INFO <<
"Received CWR... Leaving ecnEcho State\n";
206 if (tcpHeader->getRstBit()) {
208 switch (
fsm.getState()) {
235 EV_DETAIL <<
"RST: performing connection reset, closing connection\n";
245 EV_DETAIL <<
"RST: closing connection\n";
260 if (tcpHeader->getSynBit()
276 EV_DETAIL <<
"SYN is in the window: performing connection reset, closing connection\n";
284 if (!tcpHeader->getAckBit()) {
286 EV_INFO <<
"ACK not set, dropping segment\n";
307 sendRst(tcpHeader->getAckNo());
394 EV_INFO <<
"Our FIN acked -- can go to TIME_WAIT now\n";
410 EV_INFO <<
"Last ACK arrived\n";
479 if (payloadLength > 0) {
485 if (payloadLength == 1)
491 EV_DETAIL <<
"Processing segment text in a data transfer state\n";
529 EV_DETAIL <<
"SND_D-SACK SET (old_rcv_nxt == rcv_nxt duplicated oooseg rcvd)\n";
533 EV_DETAIL <<
"SND_SACK SET (old_rcv_nxt == rcv_nxt oooseg rcvd)\n";
556 EV_DETAIL <<
"All segments arrived up to the FIN segment, advancing rcv_nxt over the FIN\n";
562 switch (
fsm.getState()) {
601 EV_WARN <<
"RcvQueueBuffer has run out, dropping segment\n";
610 if (tcpHeader->getFinBit()) {
625 uint32_t fin_seq = (uint32_t)tcpHeader->getSequenceNo() + (uint32_t)payloadLength;
629 EV_INFO <<
"FIN arrived, advancing rcv_nxt over the FIN\n";
635 switch (
fsm.getState()) {
668 EV_DETAIL <<
"FIN segment above sequence, storing sequence number of FIN\n";
688 EV_DETAIL <<
"SND_SACK SET (rcv_nxt changed, but receiveQ is not empty)\n";
704 EV_DETAIL <<
"Now we can do the CLOSE which was deferred a while ago\n";
715 EV_DETAIL <<
"Now we can do the CLOSE which was deferred a while ago\n";
Referenced by process_RCV_SEGMENT().
◆ processSegmentInListen()
726 EV_DETAIL <<
"Processing segment in LISTEN\n";
732 if (tcpHeader->getRstBit()) {
733 EV_INFO <<
"RST bit set: dropping segment\n";
748 if (tcpHeader->getAckBit()) {
749 EV_INFO <<
"ACK bit set: dropping segment and sending RST\n";
750 sendRst(tcpHeader->getAckNo(), destAddr, srcAddr, tcpHeader->getDestPort(), tcpHeader->getSrcPort());
757 if (tcpHeader->getSynBit()) {
758 if (tcpHeader->getFinBit()) {
762 EV_INFO <<
"SYN+FIN received: ignoring FIN\n";
765 EV_DETAIL <<
"SYN bit set: filling in foreign socket and sending SYN+ACK\n";
778 EV_DETAIL <<
"Connection forked: new connection got new socketId=" << conn->socketId <<
", "
779 "old connection keeps LISTENing with socketId=" <<
socketId <<
"\n";
780 TcpEventCode forkEvent = conn->processSynInListen(tcpSegment, tcpHeader, srcAddr, destAddr);
781 conn->performStateTransition(forkEvent);
795 EV_WARN <<
"Unexpected segment: dropping it\n";
Referenced by process_RCV_SEGMENT().
◆ processSegmentInSynSent()
874 EV_DETAIL <<
"Processing segment in SYN_SENT\n";
890 if (tcpHeader->getAckBit()) {
892 if (tcpHeader->getRstBit())
893 EV_DETAIL <<
"ACK+RST bit set but wrong AckNo, ignored\n";
895 EV_DETAIL <<
"ACK bit set but wrong AckNo, sending RST\n";
896 sendRst(tcpHeader->getAckNo(), destAddr, srcAddr, tcpHeader->getDestPort(), tcpHeader->getSrcPort());
901 EV_DETAIL <<
"ACK bit set, AckNo acceptable\n";
914 if (tcpHeader->getRstBit()) {
915 if (tcpHeader->getAckBit()) {
916 EV_DETAIL <<
"RST+ACK: performing connection reset\n";
922 EV_DETAIL <<
"RST without ACK: dropping segment\n";
939 if (tcpHeader->getSynBit()) {
951 state->
irs = tcpHeader->getSequenceNo();
954 if (tcpHeader->getAckBit()) {
982 EV_INFO <<
"SYN+ACK bits set, connection established.\n";
990 if (tcpHeader->getFinBit())
991 EV_DETAIL <<
"SYN+ACK+FIN received: ignoring FIN\n";
993 if (
B(tcpSegment->getByteLength()) > tcpHeader->getHeaderLength()) {
1004 EV_WARN <<
"RcvQueueBuffer has run out, dropping segment\n";
1009 if (tcpHeader->getUrgBit() || tcpHeader->getPshBit())
1010 EV_DETAIL <<
"Ignoring URG and PSH bits in SYN+ACK\n";
1023 if (tcpHeader->getEceBit() && !tcpHeader->getCwrBit()) {
1025 EV <<
"ECN-setup SYN-ACK packet was received... ECN is enabled.\n";
1029 EV <<
"non-ECN-setup SYN-ACK packet was received... ECN is disabled.\n";
1035 if (tcpHeader->getEceBit() && !tcpHeader->getCwrBit())
1036 EV <<
"ECN-setup SYN-ACK packet was received... ECN is disabled.\n";
1053 EV_INFO <<
"SYN bit set: sending SYN+ACK\n";
1061 if (tcpHeader->getFinBit())
1062 EV_DETAIL <<
"SYN+FIN received: ignoring FIN\n";
1067 if (
B(tcpSegment->getByteLength()) > tcpHeader->getHeaderLength()) {
1078 EV_WARN <<
"RcvQueueBuffer has run out, dropping segment\n";
1083 if (tcpHeader->getUrgBit() || tcpHeader->getPshBit())
1084 EV_DETAIL <<
"Ignoring URG and PSH bits in SYN\n";
Referenced by process_RCV_SEGMENT().
◆ processSynInListen()
816 state->
irs = tcpHeader->getSequenceNo();
830 if (tcpHeader->getEceBit() ==
true && tcpHeader->getCwrBit() ==
true) {
832 EV <<
"ECN-setup SYN packet received\n";
850 if (
B(tcpSegment->getByteLength()) > tcpHeader->getHeaderLength()) {
861 EV_WARN <<
"RcvQueueBuffer has run out, dropping segment\n";
866 if (tcpHeader->getUrgBit() || tcpHeader->getPshBit())
867 EV_DETAIL <<
"Ignoring URG and PSH bits in SYN\n";
Referenced by processSegmentInListen().
◆ processTCPSegment()
Process incoming TCP segment.
Normally returns true. A return value of false means that the connection structure must be deleted by the caller (TCP).
290 ASSERT(
localPort == tcpHeader->getDestPort());
295 ASSERT(
remotePort == tcpHeader->getSrcPort());
Referenced by inet::tcp::Tcp::handleLowerPacket().
◆ processTimer()
| bool inet::tcp::TcpConnection::processTimer |
( |
cMessage * |
msg | ) |
|
|
virtual |
Process self-messages (timers).
Normally returns true. A return value of false means that the connection structure must be deleted by the caller (TCP).
252 EV_DETAIL << msg->getName() <<
" timer expired\n";
Referenced by handleMessage().
◆ processTSOption()
1176 if (option.getLength() != 10) {
1177 EV_ERROR <<
"ERROR: length incorrect\n";
1185 EV_ERROR <<
"ERROR: Tcp Header Option TS received, but in unexpected state\n";
1192 EV_INFO <<
"Tcp Header Option TS(TSval=" << option.getSenderTimestamp() <<
", TSecr=" << option.getEchoedTimestamp() <<
") received, TS (ts_enabled) is set to " <<
state->
ts_enabled <<
"\n";
1195 EV_INFO <<
"Tcp Header Option TS(TSval=" << option.getSenderTimestamp() <<
", TSecr=" << option.getEchoedTimestamp() <<
") received\n";
1209 EV_DETAIL <<
"PAWS: Segment is not acceptable, TSval=" << option.getSenderTimestamp() <<
" in " <<
stateName(
fsm.getState()) <<
" state received: dropping segment\n";
1215 EV_DETAIL <<
"Updating ts_recent from segment: new ts_recent=" <<
state->
ts_recent <<
"\n";
Referenced by readHeaderOptions().
◆ processWSOption()
1151 if (option.getLength() != 3) {
1152 EV_ERROR <<
"ERROR: length incorrect\n";
1157 EV_ERROR <<
"ERROR: Tcp Header Option WS received, but in unexpected state\n";
1167 EV_ERROR <<
"ERROR: Tcp Header Option WS received but shift count value is exceeding 14\n";
Referenced by readHeaderOptions().
◆ readHeaderOptions()
| void inet::tcp::TcpConnection::readHeaderOptions |
( |
const Ptr< const TcpHeader > & |
tcpHeader | ) |
|
|
protectedvirtual |
Utility: readHeaderOptions (Currently only EOL, NOP, MSS, WS, SACK_PERMITTED, SACK and TS are implemented)
1064 EV_INFO <<
"Tcp Header Option(s) received:\n";
1066 for (
uint i = 0; i < tcpHeader->getHeaderOptionArraySize(); i++) {
1067 const TcpOption *option = tcpHeader->getHeaderOption(i);
1068 short kind = option->getKind();
1069 short length = option->getLength();
1072 EV_DETAIL <<
"Option type " <<
kind <<
" (" <<
optionName(
kind) <<
"), length " << length <<
"\n";
1078 EV_ERROR <<
"ERROR: option length incorrect\n";
1084 ok =
processMSSOption(tcpHeader, *check_and_cast<const TcpOptionMaxSegmentSize *>(option));
1088 ok =
processWSOption(tcpHeader, *check_and_cast<const TcpOptionWindowScale *>(option));
1096 ok =
processSACKOption(tcpHeader, *check_and_cast<const TcpOptionSack *>(option));
1100 ok =
processTSOption(tcpHeader, *check_and_cast<const TcpOptionTimestamp *>(option));
1107 EV_ERROR <<
"ERROR: Unsupported Tcp option kind " <<
kind <<
"\n";
Referenced by processSegment1stThru8th(), processSegmentInSynSent(), and processSynInListen().
◆ retransmitData()
| void inet::tcp::TcpConnection::retransmitData |
( |
| ) |
|
|
virtual |
Utility: retransmit all from snd_una to snd_max.
1031 EV_DETAIL <<
"No outstanding DATA, resending FIN, advancing snd_nxt over the FIN\n";
1040 ASSERT(bytesToSend != 0);
1043 while (bytesToSend > 0) {
1053 ASSERT(bytesToSend >= sentBytes);
1054 bytesToSend -= sentBytes;
Referenced by inet::tcp::DumbTcp::processTimer().
◆ retransmitOneSegment()
| void inet::tcp::TcpConnection::retransmitOneSegment |
( |
bool |
called_at_rto | ) |
|
|
virtual |
Utility: retransmit one segment from snd_una.
980 EV_DETAIL <<
"No outstanding DATA, resending FIN, advancing snd_nxt over the FIN\n";
994 if (!called_at_rto) {
Referenced by inet::tcp::TcpNoCongestionControl::processRexmitTimer(), inet::tcp::TcpNewReno::processRexmitTimer(), inet::tcp::TcpReno::processRexmitTimer(), inet::tcp::TcpTahoe::processRexmitTimer(), inet::tcp::TcpWestwood::processRexmitTimer(), inet::tcp::TcpVegas::processRexmitTimer(), inet::tcp::TcpNewReno::receivedDataAck(), inet::tcp::TcpVegas::receivedDataAck(), inet::tcp::TcpNewReno::receivedDuplicateAck(), inet::tcp::TcpReno::receivedDuplicateAck(), inet::tcp::TcpTahoe::receivedDuplicateAck(), inet::tcp::TcpWestwood::receivedDuplicateAck(), and inet::tcp::TcpVegas::receivedDuplicateAck().
◆ segmentArrivalWhileClosed()
This method gets invoked from TCP when a segment arrives which doesn't belong to an existing connection.
TCP creates a temporary connection object so that it can call this method, then immediately deletes it.
30 EV_INFO <<
"Seg arrived: ";
36 ASSERT(
state ==
nullptr);
38 EV_INFO <<
"Segment doesn't belong to any existing connection\n";
62 if (tcpHeader->getRstBit()) {
63 EV_DETAIL <<
"RST bit set: dropping segment\n";
67 if (!tcpHeader->getAckBit()) {
68 EV_DETAIL <<
"ACK bit not set: sending RST+ACK\n";
69 uint32_t ackNo = tcpHeader->getSequenceNo() + tcpSegment->getByteLength() -
B(tcpHeader->getHeaderLength()).get() + tcpHeader->getSynFinLen();
70 sendRstAck(0, ackNo, destAddr, srcAddr, tcpHeader->getDestPort(), tcpHeader->getSrcPort());
73 EV_DETAIL <<
"ACK bit set: sending RST\n";
74 sendRst(tcpHeader->getAckNo(), destAddr, srcAddr, tcpHeader->getDestPort(), tcpHeader->getSrcPort());
◆ selectInitialSeqNum()
| void inet::tcp::TcpConnection::selectInitialSeqNum |
( |
| ) |
|
|
protectedvirtual |
◆ sendAck()
| void inet::tcp::TcpConnection::sendAck |
( |
| ) |
|
|
virtual |
Utility: send ACK.
681 const auto& tcpHeader = makeShared<TcpHeader>();
683 tcpHeader->setAckBit(
true);
703 tcpHeader->setEceBit(
true);
704 EV_INFO <<
"In ecnEcho state... send ACK with ECE bit set\n";
710 Packet *fp =
new Packet(
"TcpAck");
Referenced by inet::tcp::TcpNoCongestionControl::established(), inet::tcp::DumbTcp::established(), inet::tcp::TcpBaseAlg::established(), inet::tcp::TcpBaseAlg::processDelayedAckTimer(), processSegment1stThru8th(), inet::tcp::DumbTcp::receivedAckForDataNotYetSent(), inet::tcp::TcpBaseAlg::receivedAckForDataNotYetSent(), inet::tcp::DumbTcp::receivedOutOfOrderSegment(), inet::tcp::TcpBaseAlg::receivedOutOfOrderSegment(), inet::tcp::DumbTcp::receiveSeqChanged(), and inet::tcp::TcpBaseAlg::receiveSeqChanged().
◆ sendAvailableDataToApp()
| void inet::tcp::TcpConnection::sendAvailableDataToApp |
( |
| ) |
|
|
protectedvirtual |
◆ sendAvailableIndicationToApp()
| void inet::tcp::TcpConnection::sendAvailableIndicationToApp |
( |
| ) |
|
|
protectedvirtual |
Utility: sends TCP_I_AVAILABLE indication with TcpAvailableInfo to application.
356 TcpAvailableInfo *ind =
new TcpAvailableInfo();
364 indication->setControlInfo(ind);
Referenced by processSegment1stThru8th().
◆ sendData()
| bool inet::tcp::TcpConnection::sendData |
( |
uint32_t |
congestionWindow | ) |
|
|
virtual |
Utility: Send data from sendQueue, at most congestionWindow.
854 uint32_t old_highRxt = 0;
871 if (effectiveWin <= 0) {
872 EV_WARN <<
"Effective window is zero (advertised window " <<
state->
snd_wnd
873 <<
", congestion window " << congestionWindow <<
"), cannot send.\n";
877 uint32_t bytesToSend =
std::min(buffered, (uint32_t)effectiveWin);
880 const auto& tmpTcpHeader = makeShared<TcpHeader>();
881 tmpTcpHeader->setAckBit(
true);
884 ASSERT(options_len < state->snd_mss);
890 EV_INFO <<
"May send " << bytesToSend <<
" bytes (effectiveWindow " << effectiveWin <<
", in buffer " << buffered <<
" bytes)\n";
893 while (bytesToSend >= effectiveMss) {
895 ASSERT(bytesToSend >= sentBytes);
896 bytesToSend -= sentBytes;
899 if (bytesToSend > 0) {
906 EV_WARN <<
"Cannot send (last) segment due to Nagle, not enough data for a full segment\n";
921 EV_DETAIL <<
"Retransmission sent during recovery, restarting REXMIT timer.\n";
Referenced by inet::tcp::DumbTcp::established(), inet::tcp::DumbTcp::receivedDataAck(), inet::tcp::DumbTcp::sendCommandInvoked(), inet::tcp::TcpNoCongestionControl::sendData(), and inet::tcp::TcpBaseAlg::sendData().
◆ sendDataDuringLossRecoveryPhase()
| void inet::tcp::TcpConnection::sendDataDuringLossRecoveryPhase |
( |
uint32_t |
congestionWindow | ) |
|
|
virtual |
◆ sendEstabIndicationToApp()
| void inet::tcp::TcpConnection::sendEstabIndicationToApp |
( |
| ) |
|
|
protectedvirtual |
◆ sendFin()
| void inet::tcp::TcpConnection::sendFin |
( |
| ) |
|
|
virtual |
◆ sendIndicationToApp()
| void inet::tcp::TcpConnection::sendIndicationToApp |
( |
int |
code, |
|
|
const int |
id = 0 |
|
) |
| |
|
protectedvirtual |
◆ sendOneNewSegment()
| void inet::tcp::TcpConnection::sendOneNewSegment |
( |
bool |
fullSegmentsOnly, |
|
|
uint32_t |
congestionWindow |
|
) |
| |
|
virtual |
Utility: send one new segment from snd_max if allowed (RFC 3042).
1550 if (buffered >=
state->
snd_mss || (!fullSegmentsOnly && buffered > 0)) {
1563 if (bytes >=
state->
snd_mss || (!fullSegmentsOnly && bytes > 0)) {
1568 EV_DETAIL <<
"Limited Transmit algorithm enabled. Sending one new segment.\n";
Referenced by inet::tcp::TcpBaseAlg::receivedDuplicateAck().
◆ sendProbe()
| bool inet::tcp::TcpConnection::sendProbe |
( |
| ) |
|
|
virtual |
◆ sendRst() [1/2]
| void inet::tcp::TcpConnection::sendRst |
( |
uint32_t |
seq, |
|
|
L3Address |
src, |
|
|
L3Address |
dest, |
|
|
int |
srcPort, |
|
|
int |
destPort |
|
) |
| |
|
virtual |
Utility: sends RST; does not use connection state.
639 const auto& tcpHeader = makeShared<TcpHeader>();
641 tcpHeader->setSrcPort(srcPort);
642 tcpHeader->setDestPort(destPort);
644 tcpHeader->setRstBit(
true);
645 tcpHeader->setSequenceNo(seq);
647 tcpHeader->setCrc(0);
649 Packet *fp =
new Packet(
"RST");
◆ sendRst() [2/2]
| void inet::tcp::TcpConnection::sendRst |
( |
uint32_t |
seqNo | ) |
|
|
virtual |
◆ sendRstAck()
| void inet::tcp::TcpConnection::sendRstAck |
( |
uint32_t |
seq, |
|
|
uint32_t |
ack, |
|
|
L3Address |
src, |
|
|
L3Address |
dest, |
|
|
int |
srcPort, |
|
|
int |
destPort |
|
) |
| |
|
virtual |
Utility: sends RST+ACK; does not use connection state.
657 const auto& tcpHeader = makeShared<TcpHeader>();
659 tcpHeader->setSrcPort(srcPort);
660 tcpHeader->setDestPort(destPort);
662 tcpHeader->setRstBit(
true);
663 tcpHeader->setAckBit(
true);
664 tcpHeader->setSequenceNo(seq);
665 tcpHeader->setAckNo(ack);
667 tcpHeader->setCrc(0);
669 Packet *fp =
new Packet(
"RST+ACK");
Referenced by segmentArrivalWhileClosed().
◆ sendSegment()
| uint32_t inet::tcp::TcpConnection::sendSegment |
( |
uint32_t |
bytes | ) |
|
|
virtual |
Utility: sends one segment of 'bytes' bytes from snd_nxt, and advances snd_nxt.
sendData(), sendProbe() and retransmitData() internally all rely on this one. Returns the number of bytes sent.
752 EV_INFO <<
"sendSegment(" << bytes <<
") forwarded " << forward <<
" bytes of snd_nxt from " <<
state->
snd_nxt;
761 if (bytes > buffered)
767 const auto& tmpTcpHeader = makeShared<TcpHeader>();
768 tmpTcpHeader->setAckBit(
true);
772 ASSERT(options_len < state->snd_mss);
777 uint32_t sentBytes = bytes;
781 const auto& tcpHeader = makeShared<TcpHeader>();
783 ASSERT(tcpHeader !=
nullptr);
789 tcpHeader->setAckBit(
true);
794 tcpHeader->setCwrBit(
true);
795 EV_INFO <<
"set CWR bit\n";
801 ASSERT(bytes == tcpSegment->getByteLength());
810 EV_DETAIL <<
"Setting FIN on segment\n";
811 tcpHeader->setFinBit(
true);
820 for (
uint i = 0; i < tmpTcpHeader->getHeaderOptionArraySize(); i++)
821 tcpHeader->appendHeaderOption(tmpTcpHeader->getHeaderOption(i)->dup());
823 tcpHeader->setChunkLength(
B(tcpHeader->getHeaderLength()));
825 ASSERT(tcpHeader->getHeaderLength() == tmpTcpHeader->getHeaderLength());
Referenced by retransmitData(), retransmitOneSegment(), sendData(), sendOneNewSegment(), sendProbe(), and sendSegmentDuringLossRecoveryPhase().
◆ sendSegmentDuringLossRecoveryPhase()
| uint32_t inet::tcp::TcpConnection::sendSegmentDuringLossRecoveryPhase |
( |
uint32_t |
seqNum | ) |
|
|
virtual |
Utility: send segment during Loss Recovery phase (if SACK is enabled).
Returns the number of bytes sent.
373 uint32_t sentSeqNum = seqNum + sentBytes;
376 sentSeqNum = sentSeqNum + 1;
421 EV_INFO <<
"Retransmission sent during recovery, restarting REXMIT timer.\n";
Referenced by sendDataDuringLossRecoveryPhase().
◆ sendSyn()
| void inet::tcp::TcpConnection::sendSyn |
( |
| ) |
|
|
protectedvirtual |
Utility: send SYN.
541 throw cRuntimeError(
tcpMain,
"Error processing command OPEN_ACTIVE: foreign socket unspecified");
544 throw cRuntimeError(
tcpMain,
"Error processing command OPEN_ACTIVE: local port unspecified");
547 const auto& tcpHeader = makeShared<TcpHeader>();
548 tcpHeader->setSequenceNo(
state->
iss);
549 tcpHeader->setSynBit(
true);
557 tcpHeader->setEceBit(
true);
558 tcpHeader->setCwrBit(
true);
560 EV <<
"ECN-setup SYN packet sent\n";
567 tcpHeader->setEceBit(
false);
568 tcpHeader->setCwrBit(
false);
575 Packet *fp =
new Packet(
"SYN");
Referenced by process_OPEN_ACTIVE(), process_SEND(), and process_TIMEOUT_SYN_REXMIT().
◆ sendSynAck()
| void inet::tcp::TcpConnection::sendSynAck |
( |
| ) |
|
|
protectedvirtual |
Utility: send SYN+ACK.
584 const auto& tcpHeader = makeShared<TcpHeader>();
585 tcpHeader->setSequenceNo(
state->
iss);
587 tcpHeader->setSynBit(
true);
588 tcpHeader->setAckBit(
true);
596 tcpHeader->setEceBit(
true);
597 tcpHeader->setCwrBit(
false);
598 EV <<
"ECN-setup SYN-ACK packet sent\n";
601 tcpHeader->setEceBit(
false);
602 tcpHeader->setCwrBit(
false);
604 EV <<
"non-ECN-setup SYN-ACK packet sent\n";
608 EV <<
"both end-points are willing to use ECN... ECN is enabled\n";
617 EV <<
"ECN is disabled\n";
623 Packet *fp =
new Packet(
"SYN+ACK");
Referenced by process_TIMEOUT_SYN_REXMIT(), processSegmentInSynSent(), and processSynInListen().
◆ sendToApp()
| void inet::tcp::TcpConnection::sendToApp |
( |
cMessage * |
msg | ) |
|
|
protectedvirtual |
◆ sendToIP() [1/2]
Utility: send IP packet.
311 EV_INFO <<
"Sending: ";
314 IL3AddressType *addressType = dest.getAddressType();
315 ASSERT(tcpHeader->getChunkLength() == tcpHeader->getHeaderLength());
316 tcpSegment->addTagIfAbsent<
DispatchProtocolReq>()->setProtocol(addressType->getNetworkProtocol());
321 if (
dscp != -1 && tcpSegment->findTag<
DscpReq>() ==
nullptr)
322 tcpSegment->addTag<
DscpReq>()->setDifferentiatedServicesCodePoint(
dscp);
324 if (
tos != -1 && tcpSegment->findTag<TosReq>() ==
nullptr)
325 tcpSegment->addTag<TosReq>()->setTos(
tos);
327 auto addresses = tcpSegment->addTagIfAbsent<L3AddressReq>();
328 addresses->setSrcAddress(src);
329 addresses->setDestAddress(dest);
◆ sendToIP() [2/2]
| void inet::tcp::TcpConnection::sendToIP |
( |
Packet * |
tcpSegment, |
|
|
const Ptr< TcpHeader > & |
tcpHeader |
|
) |
| |
|
virtual |
Utility: adds control info to segment and sends it to IP.
249 if (tcpSegment->getByteLength() >
B(tcpHeader->getChunkLength()).get())
259 ASSERT(tcpHeader->getChunkLength() == tcpHeader->getHeaderLength());
261 EV_INFO <<
"Sending: ";
267 tcpSegment->addTagIfAbsent<
DispatchProtocolReq>()->setProtocol(addressType->getNetworkProtocol());
272 if (
dscp != -1 && tcpSegment->findTag<
DscpReq>() ==
nullptr)
273 tcpSegment->addTag<
DscpReq>()->setDifferentiatedServicesCodePoint(
dscp);
275 if (
tos != -1 && tcpSegment->findTag<TosReq>() ==
nullptr)
276 tcpSegment->addTag<TosReq>()->setTos(
tos);
278 auto addresses = tcpSegment->addTagIfAbsent<L3AddressReq>();
300 tcpHeader->setCrc(0);
Referenced by sendAck(), sendFin(), sendRst(), sendRstAck(), sendSegment(), sendSyn(), and sendSynAck().
◆ setPipe()
| void inet::tcp::TcpConnection::setPipe |
( |
| ) |
|
|
virtual |
◆ setSocketId()
| void inet::tcp::TcpConnection::setSocketId |
( |
int |
newSocketId | ) |
|
|
inline |
◆ signalConnectionTimeout()
| void inet::tcp::TcpConnection::signalConnectionTimeout |
( |
| ) |
|
|
virtual |
◆ startSynRexmitTimer()
| void inet::tcp::TcpConnection::startSynRexmitTimer |
( |
| ) |
|
|
virtual |
◆ stateEntered()
| void inet::tcp::TcpConnection::stateEntered |
( |
int |
state, |
|
|
int |
oldState, |
|
|
TcpEventCode |
event |
|
) |
| |
|
protectedvirtual |
◆ stateName()
| const char * inet::tcp::TcpConnection::stateName |
( |
int |
state | ) |
|
|
static |
◆ tryFastRoute()
| bool inet::tcp::TcpConnection::tryFastRoute |
( |
const Ptr< const TcpHeader > & |
tcpHeader | ) |
|
|
protectedvirtual |
Shortcut to process most common case as fast as possible.
Returns false if segment requires normal (slow) route.
Referenced by processTCPSegment().
◆ updateRcvQueueVars()
| void inet::tcp::TcpConnection::updateRcvQueueVars |
( |
| ) |
|
|
virtual |
◆ updateRcvWnd()
| unsigned short inet::tcp::TcpConnection::updateRcvWnd |
( |
| ) |
|
|
virtual |
Utility: update receive window (rcv_wnd), and calculate scaled value if window scaling enabled.
Returns the (scaled) receive window size.
1481 ASSERT(scaled_rcv_wnd == (
unsigned short)scaled_rcv_wnd);
1483 return (
unsigned short)scaled_rcv_wnd;
Referenced by sendAck(), sendFin(), sendSegment(), sendSyn(), and sendSynAck().
◆ updateWndInfo()
| void inet::tcp::TcpConnection::updateWndInfo |
( |
const Ptr< const TcpHeader > & |
tcpHeader, |
|
|
bool |
doAlways = false |
|
) |
| |
|
virtual |
◆ writeHeaderOptions()
| TcpHeader inet::tcp::TcpConnection::writeHeaderOptions |
( |
const Ptr< TcpHeader > & |
tcpHeader | ) |
|
|
protectedvirtual |
Utility: writeHeaderOptions (Currently only EOL, NOP, MSS, WS, SACK_PERMITTED, SACK and TS are implemented)
1249 TcpOptionMaxSegmentSize *option =
new TcpOptionMaxSegmentSize();
1251 tcpHeader->appendHeaderOption(option);
1252 EV_INFO <<
"Tcp Header Option MSS(=" <<
state->
snd_mss <<
") sent\n";
1260 tcpHeader->appendHeaderOption(
new TcpOptionNop());
1271 scaled_rcv_wnd = scaled_rcv_wnd >> 1;
1276 TcpOptionWindowScale *option =
new TcpOptionWindowScale();
1280 EV_INFO <<
"Tcp Header Option WS(=" << option->getWindowScale() <<
") sent, WS (ws_enabled) is set to " <<
state->
ws_enabled <<
"\n";
1281 tcpHeader->appendHeaderOption(option);
1290 tcpHeader->appendHeaderOption(
new TcpOptionNop());
1291 tcpHeader->appendHeaderOption(
new TcpOptionNop());
1294 tcpHeader->appendHeaderOption(
new TcpOptionSackPermitted());
1299 EV_INFO <<
"Tcp Header Option SACK_PERMITTED sent, SACK (sack_enabled) is set to " <<
state->
sack_enabled <<
"\n";
1308 tcpHeader->appendHeaderOption(
new TcpOptionNop());
1309 tcpHeader->appendHeaderOption(
new TcpOptionNop());
1312 TcpOptionTimestamp *option =
new TcpOptionTimestamp();
1325 option->setEchoedTimestamp(tcpHeader->getAckBit() ?
state->
ts_recent : 0);
1329 EV_INFO <<
"Tcp Header Option TS(TSval=" << option->getSenderTimestamp() <<
", TSecr=" << option->getEchoedTimestamp() <<
") sent, TS (ts_enabled) is set to " <<
state->
ts_enabled <<
"\n";
1330 tcpHeader->appendHeaderOption(option);
1343 tcpHeader->appendHeaderOption(
new TcpOptionNop());
1344 tcpHeader->appendHeaderOption(
new TcpOptionNop());
1347 TcpOptionTimestamp *option =
new TcpOptionTimestamp();
1360 option->setEchoedTimestamp(tcpHeader->getAckBit() ?
state->
ts_recent : 0);
1362 EV_INFO <<
"Tcp Header Option TS(TSval=" << option->getSenderTimestamp() <<
", TSecr=" << option->getEchoedTimestamp() <<
") sent\n";
1363 tcpHeader->appendHeaderOption(option);
1386 if (tcpHeader->getHeaderOptionArraySize() != 0) {
1387 B options_len = tcpHeader->getHeaderOptionArrayLength();
1394 tcpHeader->dropHeaderOptions();
1397 EV_ERROR <<
"ERROR: Options length exceeded! Segment will be sent without options" <<
"\n";
Referenced by sendAck(), sendData(), sendSegment(), sendSyn(), and sendSynAck().
◆ connEstabTimer
| cMessage* inet::tcp::TcpConnection::connEstabTimer = nullptr |
|
protected |
◆ dscp
| short inet::tcp::TcpConnection::dscp = -1 |
◆ dupAcksSignal
| simsignal_t inet::tcp::TcpConnection::dupAcksSignal = registerSignal("dupAcks") |
|
static |
◆ finWait2Timer
| cMessage* inet::tcp::TcpConnection::finWait2Timer = nullptr |
|
protected |
◆ fsm
| cFSM inet::tcp::TcpConnection::fsm |
|
protected |
Referenced by initClonedConnection(), initConnection(), performStateTransition(), printConnBrief(), process_ABORT(), process_CLOSE(), process_OPEN_ACTIVE(), process_OPEN_PASSIVE(), process_RCV_SEGMENT(), process_SEND(), process_STATUS(), process_TIMEOUT_2MSL(), process_TIMEOUT_CONN_ESTAB(), process_TIMEOUT_FIN_WAIT_2(), process_TIMEOUT_SYN_REXMIT(), processAckInEstabEtc(), processMSSOption(), processSACKOption(), processSACKPermittedOption(), processSegment1stThru8th(), processTSOption(), processWSOption(), and writeHeaderOptions().
◆ listeningSocketId
| int inet::tcp::TcpConnection::listeningSocketId = -1 |
◆ localAddr
| L3Address inet::tcp::TcpConnection::localAddr |
Referenced by inet::tcp::Tcp::addSockPair(), initClonedConnection(), printConnBrief(), process_OPEN_ACTIVE(), process_OPEN_PASSIVE(), process_STATUS(), processTCPSegment(), inet::tcp::Tcp::removeConnection(), sendAvailableIndicationToApp(), sendEstabIndicationToApp(), sendRst(), sendToIP(), and inet::tcp::Tcp::updateSockPair().
◆ localPort
| int inet::tcp::TcpConnection::localPort = -1 |
Referenced by inet::tcp::Tcp::addSockPair(), initClonedConnection(), printConnBrief(), process_OPEN_ACTIVE(), process_OPEN_PASSIVE(), process_STATUS(), processTCPSegment(), inet::tcp::Tcp::removeConnection(), sendAvailableIndicationToApp(), sendEstabIndicationToApp(), sendRst(), sendSyn(), sendToIP(), and inet::tcp::Tcp::updateSockPair().
◆ pipeSignal
| simsignal_t inet::tcp::TcpConnection::pipeSignal = registerSignal("pipe") |
|
static |
◆ rcvAckSignal
| simsignal_t inet::tcp::TcpConnection::rcvAckSignal = registerSignal("rcvAck") |
|
static |
◆ rcvAdvSignal
| simsignal_t inet::tcp::TcpConnection::rcvAdvSignal = registerSignal("rcvAdv") |
|
static |
◆ rcvNASegSignal
| simsignal_t inet::tcp::TcpConnection::rcvNASegSignal = registerSignal("rcvNASeg") |
|
static |
◆ rcvOooSegSignal
| simsignal_t inet::tcp::TcpConnection::rcvOooSegSignal = registerSignal("rcvOooSeg") |
|
static |
◆ rcvSacksSignal
| simsignal_t inet::tcp::TcpConnection::rcvSacksSignal = registerSignal("rcvSacks") |
|
static |
◆ rcvSeqSignal
| simsignal_t inet::tcp::TcpConnection::rcvSeqSignal = registerSignal("rcvSeq") |
|
static |
◆ rcvWndSignal
| simsignal_t inet::tcp::TcpConnection::rcvWndSignal = registerSignal("rcvWnd") |
|
static |
◆ receiveQueue
Referenced by addSacks(), hasEnoughSpaceForSegmentInReceiveQueue(), initClonedConnection(), initConnection(), process_READ_REQUEST(), processSegment1stThru8th(), processSegmentInSynSent(), processSynInListen(), sendAvailableDataToApp(), updateRcvQueueVars(), writeHeaderOptions(), and ~TcpConnection().
◆ remoteAddr
| L3Address inet::tcp::TcpConnection::remoteAddr |
Referenced by inet::tcp::Tcp::addSockPair(), printConnBrief(), process_OPEN_ACTIVE(), process_STATUS(), processTCPSegment(), inet::tcp::Tcp::removeConnection(), sendAvailableIndicationToApp(), sendEstabIndicationToApp(), sendRst(), sendSyn(), sendToIP(), and inet::tcp::Tcp::updateSockPair().
◆ remotePort
| int inet::tcp::TcpConnection::remotePort = -1 |
Referenced by inet::tcp::Tcp::addSockPair(), printConnBrief(), process_OPEN_ACTIVE(), process_STATUS(), processTCPSegment(), inet::tcp::Tcp::removeConnection(), sendAvailableIndicationToApp(), sendEstabIndicationToApp(), sendRst(), sendSyn(), sendToIP(), and inet::tcp::Tcp::updateSockPair().
◆ rexmitQueue
Referenced by initClonedConnection(), initConnection(), isLost(), nextSeg(), processAckInEstabEtc(), inet::tcp::TcpBaseAlg::processRexmitTimer(), processRstInSynReceived(), processSACKOption(), processSegmentInSynSent(), retransmitOneSegment(), selectInitialSeqNum(), sendData(), sendSegment(), sendSegmentDuringLossRecoveryPhase(), setPipe(), and ~TcpConnection().
◆ sackedBytesSignal
| simsignal_t inet::tcp::TcpConnection::sackedBytesSignal = registerSignal("sackedBytes") |
|
static |
◆ sendQueue
Referenced by initClonedConnection(), initConnection(), isSendQueueEmpty(), nextSeg(), process_CLOSE(), process_SEND(), processAckInEstabEtc(), processRstInSynReceived(), processSegmentInSynSent(), retransmitData(), retransmitOneSegment(), selectInitialSeqNum(), sendData(), sendOneNewSegment(), sendProbe(), sendSegment(), and ~TcpConnection().
◆ sndAckSignal
| simsignal_t inet::tcp::TcpConnection::sndAckSignal = registerSignal("sndAck") |
|
static |
◆ sndNxtSignal
| simsignal_t inet::tcp::TcpConnection::sndNxtSignal = registerSignal("sndNxt") |
|
static |
◆ sndSacksSignal
| simsignal_t inet::tcp::TcpConnection::sndSacksSignal = registerSignal("sndSacks") |
|
static |
◆ sndWndSignal
| simsignal_t inet::tcp::TcpConnection::sndWndSignal = registerSignal("sndWnd") |
|
static |
◆ socketId
| int inet::tcp::TcpConnection::socketId = -1 |
Referenced by inet::tcp::Tcp::addForkedConnection(), initConnection(), inet::tcp::operator<<(), printConnBrief(), process_READ_REQUEST(), processSegmentInListen(), inet::tcp::Tcp::removeConnection(), sendAvailableDataToApp(), sendAvailableIndicationToApp(), sendEstabIndicationToApp(), and sendIndicationToApp().
◆ state
Referenced by addSacks(), configureStateVariables(), hasEnoughSpaceForSegmentInReceiveQueue(), initClonedConnection(), initConnection(), isLost(), isSegmentAcceptable(), isSendQueueEmpty(), nextSeg(), performStateTransition(), process_ABORT(), process_CLOSE(), process_OPEN_ACTIVE(), process_OPEN_PASSIVE(), process_QUEUE_BYTES_LIMIT(), process_RCV_SEGMENT(), process_READ_REQUEST(), process_SEND(), process_STATUS(), process_TIMEOUT_CONN_ESTAB(), process_TIMEOUT_SYN_REXMIT(), processAckInEstabEtc(), processMSSOption(), processRstInSynReceived(), processSACKOption(), processSACKPermittedOption(), processSegment1stThru8th(), processSegmentInListen(), processSegmentInSynSent(), processSynInListen(), processTSOption(), processWSOption(), retransmitData(), retransmitOneSegment(), segmentArrivalWhileClosed(), selectInitialSeqNum(), sendAck(), sendAvailableDataToApp(), sendData(), sendDataDuringLossRecoveryPhase(), sendFin(), sendOneNewSegment(), sendProbe(), sendSegment(), sendSegmentDuringLossRecoveryPhase(), sendSyn(), sendSynAck(), sendToIP(), setPipe(), startSynRexmitTimer(), stateEntered(), stateName(), updateRcvQueueVars(), updateRcvWnd(), updateWndInfo(), writeHeaderOptions(), and ~TcpConnection().
◆ stateSignal
| simsignal_t inet::tcp::TcpConnection::stateSignal = registerSignal("state") |
|
static |
◆ synRexmitTimer
| cMessage* inet::tcp::TcpConnection::synRexmitTimer = nullptr |
|
protected |
◆ tcpAlgorithm
| TcpAlgorithm* inet::tcp::TcpConnection::tcpAlgorithm = nullptr |
|
protected |
Referenced by initClonedConnection(), initConnection(), process_CLOSE(), process_SEND(), processAckInEstabEtc(), processSegment1stThru8th(), processSegmentInSynSent(), processTimer(), retransmitData(), retransmitOneSegment(), sendAck(), sendData(), sendFin(), sendOneNewSegment(), sendProbe(), sendRstAck(), sendSegmentDuringLossRecoveryPhase(), sendSynAck(), stateEntered(), and ~TcpConnection().
◆ tcpConnectionAddedSignal
| simsignal_t inet::tcp::TcpConnection::tcpConnectionAddedSignal |
|
static |
◆ tcpMain
| Tcp* inet::tcp::TcpConnection::tcpMain = nullptr |
|
protected |
Referenced by cloneListeningConnection(), configureStateVariables(), handleMessage(), initConnection(), performStateTransition(), preanalyseAppCommandEvent(), process_CLOSE(), process_OPEN_ACTIVE(), process_OPEN_PASSIVE(), process_SEND(), process_TIMEOUT_2MSL(), process_TIMEOUT_CONN_ESTAB(), process_TIMEOUT_FIN_WAIT_2(), process_TIMEOUT_SYN_REXMIT(), processAppCommand(), processSegment1stThru8th(), processSegmentInListen(), processSegmentInSynSent(), sendAvailableDataToApp(), sendRst(), sendRstAck(), sendSyn(), sendToApp(), and sendToIP().
◆ tcpRcvPayloadBytesSignal
| simsignal_t inet::tcp::TcpConnection::tcpRcvPayloadBytesSignal = registerSignal("tcpRcvPayloadBytes") |
|
static |
◆ tcpRcvQueueBytesSignal
| simsignal_t inet::tcp::TcpConnection::tcpRcvQueueBytesSignal = registerSignal("tcpRcvQueueBytes") |
|
static |
◆ tcpRcvQueueDropsSignal
| simsignal_t inet::tcp::TcpConnection::tcpRcvQueueDropsSignal = registerSignal("tcpRcvQueueDrops") |
|
static |
◆ the2MSLTimer
| cMessage* inet::tcp::TcpConnection::the2MSLTimer = nullptr |
|
protected |
◆ tos
| short inet::tcp::TcpConnection::tos = -1 |
◆ ttl
| int inet::tcp::TcpConnection::ttl = -1 |
◆ unackedSignal
| simsignal_t inet::tcp::TcpConnection::unackedSignal = registerSignal("unacked") |
|
static |
The documentation for this class was generated from the following files:
@ TCP_I_TIMED_OUT
Definition: TcpCommand_m.h:133
cMessage * finWait2Timer
Definition: TcpConnection.h:384
virtual void process_TIMEOUT_FIN_WAIT_2()
Definition: TcpConnectionRcvSegment.cc:1317
int ws_manual_scale
Definition: TcpConnection.h:199
virtual std::string str() const override
Definition: TcpConnectionBase.cc:144
virtual uint32_t getTSval(const Ptr< const TcpHeader > &tcpHeader) const
Utility: get TSval from segments TS header option.
Definition: TcpConnectionUtil.cc:1404
static simsignal_t tcpRcvPayloadBytesSignal
Definition: TcpConnection.h:334
unsigned long ulong
Definition: INETDefs.h:56
static simsignal_t rcvSacksSignal
Definition: TcpConnection.h:328
virtual bool processTimer(cMessage *msg)
Process self-messages (timers).
Definition: TcpConnectionBase.cc:249
@ TCP_E_SETOPTION
Definition: TcpConnection.h:80
virtual void receivedOutOfOrderSegment()=0
Called after receiving data which are in the window, but not at its left edge (seq !...
virtual TcpEventCode processSegment1stThru8th(Packet *tcpSegment, const Ptr< const TcpHeader > &tcpHeader)
Definition: TcpConnectionRcvSegment.cc:125
#define TCP_TIMEOUT_CONN_ESTAB
Definition: TcpConnection.h:104
@ TCP_E_TIMEOUT_CONN_ESTAB
Definition: TcpConnection.h:95
virtual void dataSent(uint32_t fromseq)=0
Called after we sent data.
@ TCP_C_QUEUE_BYTES_LIMIT
Definition: TcpCommand_m.h:89
uint32_t full_sized_segment_counter
Definition: TcpConnection.h:184
virtual void addForkedConnection(TcpConnection *conn, TcpConnection *newConn, L3Address localAddr, L3Address remoteAddr, int localPort, int remotePort)
Update conn's socket pair, and register newConn (which'll keep LISTENing).
Definition: Tcp.cc:295
TcpStateVariables * state
Definition: TcpConnection.h:364
@ TCP_C_SETOPTION
Definition: TcpCommand_m.h:92
virtual void process_TIMEOUT_CONN_ESTAB()
Definition: TcpConnectionRcvSegment.cc:1275
virtual void setSackedBit(uint32_t fromSeqNum, uint32_t toSeqNum)
Called when data sender received selective acknowledgments.
Definition: TcpSackRexmitQueue.cc:177
virtual bool performStateTransition(const TcpEventCode &event)
Implemements the pure TCP state machine.
Definition: TcpConnectionBase.cc:414
bool fin_ack_rcvd
Definition: TcpConnection.h:171
const B TCP_MAX_HEADER_LENGTH
Definition: TcpHeader_m.h:64
virtual void established(bool active)=0
Called when the connection is going to ESTABLISHED from SYN_SENT or SYN_RCVD.
static simsignal_t sndWndSignal
Definition: TcpConnection.h:317
virtual void startSynRexmitTimer()
Utility: start SYN-REXMIT timer.
Definition: TcpConnectionRcvSegment.cc:1332
virtual bool isToBeAccepted() const
Utility: returns true if the connection is not yet accepted by the application.
Definition: TcpConnection.h:489
virtual void process_DESTROY(TcpEventCode &event, TcpCommand *tcpCommand, cMessage *msg)
Definition: TcpConnectionEventProc.cc:276
@ TCP_I_CLOSED
Definition: TcpCommand_m.h:130
virtual bool isLost(uint32_t seqNum)
For SACK TCP.
Definition: TcpConnectionSackUtil.cc:123
uint32_t rcv_naseg
Definition: TcpConnection.h:240
@ TCP_E_RCV_SYN_ACK
Definition: TcpConnection.h:86
#define TCP_TIMEOUT_SYN_REXMIT_MAX
Definition: TcpConnection.h:107
virtual TcpHeader addSacks(const Ptr< TcpHeader > &tcpHeader)
Utility: adds SACKs to segments header options field.
Definition: TcpConnectionSackUtil.cc:430
virtual bool isSegmentAcceptable(Packet *tcpSegment, const Ptr< const TcpHeader > &tcpHeader) const
Utility: check if segment is acceptable (all bytes are in receive window)
Definition: TcpConnectionUtil.cc:486
@ TCP_E_RCV_FIN_ACK
Definition: TcpConnection.h:88
virtual void initialize()
Should be redefined to initialize the object: create timers, etc.
Definition: TcpAlgorithm.h:70
@ IP_ECN_NOT_ECT
Definition: EcnTag_m.h:59
virtual uint32_t getBufferStartSeq() const
Returns the sequence number of the first byte stored in the buffer.
Definition: TcpSendQueue.cc:47
virtual std::string detailedInfo() const
Prints the current rexmitQueue status for debug purposes.
Definition: TcpSackRexmitQueue.cc:40
bool limited_transmit_enabled
Definition: TcpConnection.h:181
const TcpStateVariables * getState() const
Definition: TcpConnection.h:613
virtual Packet * createSegmentWithBytes(uint32_t fromSeq, uint32_t numBytes)
Called when the TCP wants to send or retransmit data, it constructs a TCP segment which contains the ...
Definition: TcpSendQueue.cc:62
removed DscpReq Ipv4ControlInfo Ipv6ControlInfo up L3AddressInd DispatchProtocolReq L4PortInd Ipv4ControlInfo Ipv6ControlInfo down DscpReq
Definition: IUdp-gates.txt:25
virtual void updateSockPair(TcpConnection *conn, L3Address localAddr, L3Address remoteAddr, int localPort, int remotePort)
To be called from TcpConnection when socket pair (key for TcpConnMap) changes (e.g.
Definition: Tcp.cc:333
virtual void sendAck()
Utility: send ACK.
Definition: TcpConnectionUtil.cc:679
virtual void receivedDuplicateAck()=0
Called after we received a duplicate ACK (that is: ackNo == snd_una, no data in segment,...
static const Protocol tcp
Definition: Protocol.h:112
@ TCP_I_ESTABLISHED
Definition: TcpCommand_m.h:128
uint32_t start_seqno
Definition: TcpConnection.h:219
uint32_t ts_recent
Definition: TcpConnection.h:210
virtual bool processTSOption(const Ptr< const TcpHeader > &tcpHeader, const TcpOptionTimestamp &option)
Definition: TcpConnectionUtil.cc:1174
void setSocketId(int newSocketId)
Definition: TcpConnection.h:339
virtual void processTimer(cMessage *timer, TcpEventCode &event)=0
Place to process timers specific to this TcpAlgorithm class.
bool snd_initial_ts
Definition: TcpConnection.h:208
const B TCP_OPTION_HEAD_SIZE
Definition: TcpHeader_m.h:67
static simsignal_t rcvAckSignal
Definition: TcpConnection.h:323
virtual void sendRst(uint32_t seqNo)
Utility: sends RST.
Definition: TcpConnectionUtil.cc:632
virtual void rttMeasurementCompleteUsingTS(uint32_t echoedTS)=0
Converting uint32_t echoedTS to simtime_t and calling rttMeasurementComplete() to update state vars w...
@ TCP_I_PEER_CLOSED
Definition: TcpCommand_m.h:129
virtual void process_ABORT(TcpEventCode &event, TcpCommand *tcpCommand, cMessage *msg)
Definition: TcpConnectionEventProc.cc:247
bool ws_support
Definition: TcpConnection.h:197
bool snd_dsack
Definition: TcpConnection.h:222
bool rcv_ws
Definition: TcpConnection.h:201
uint32_t rcv_wnd
Definition: TcpConnection.h:158
double min(const double a, const double b)
Returns the minimum of a and b.
Definition: SctpAssociation.h:261
uint32_t freeRcvBuffer
Definition: TcpConnection.h:245
uint32_t dupacks
Definition: TcpConnection.h:236
virtual void removeConnection(TcpConnection *conn)
Definition: Tcp.cc:198
virtual TcpConnection * cloneListeningConnection()
Utility: clone a listening connection.
Definition: TcpConnectionUtil.cc:234
TcpConnection()
Definition: TcpConnection.h:582
uint32_t sackedBytes
Definition: TcpConnection.h:227
uint32_t rcv_sacks
Definition: TcpConnection.h:238
TcpReceiveQueue * receiveQueue
Definition: TcpConnection.h:369
virtual void connectionClosed()=0
Called when the connection closes, it should cancel all running timers.
@ TCP_I_AVAILABLE
Definition: TcpCommand_m.h:127
virtual void sendToApp(cMessage *msg)
Utility: sends packet to application.
Definition: TcpConnectionUtil.cc:382
virtual void process_READ_REQUEST(TcpEventCode &event, TcpCommand *tcpCommand, cMessage *msg)
Definition: TcpConnectionEventProc.cc:159
@ TCP_E_IGNORE
Definition: TcpConnection.h:66
CrcMode crcMode
Definition: Tcp.h:135
virtual uint32_t sendSegmentDuringLossRecoveryPhase(uint32_t seqNum)
Utility: send segment during Loss Recovery phase (if SACK is enabled).
Definition: TcpConnectionSackUtil.cc:360
removed DscpReq Ipv4ControlInfo Ipv6ControlInfo up L3AddressInd DispatchProtocolReq L4PortInd Ipv4ControlInfo Ipv6ControlInfo down DispatchProtocolReq
Definition: IUdp-gates.txt:25
virtual Packet * extractBytesUpTo(uint32_t seq)
Should create a packet to be passed up to the app, up to (but NOT including) the given sequence no (u...
Definition: TcpReceiveQueue.cc:80
static simsignal_t rcvWndSignal
Definition: TcpConnection.h:318
TcpAlgorithm * tcpAlgorithm
Definition: TcpConnection.h:378
bool sack_support
Definition: TcpConnection.h:215
virtual TcpReceiveQueue * createReceiveQueue()
To be called from TcpConnection: create a new receive queue.
Definition: Tcp.cc:363
virtual void process_OPEN_ACTIVE(TcpEventCode &event, TcpCommand *tcpCommand, cMessage *msg)
Definition: TcpConnectionEventProc.cc:26
@ TCP_C_ACCEPT
Definition: TcpCommand_m.h:84
@ TCPOPTION_SACK_PERMITTED
Definition: TcpHeader_m.h:119
TcpSendQueue * sendQueue
Definition: TcpConnection.h:367
virtual void sendIndicationToApp(int code, const int id=0)
Utility: sends status indication (TCP_I_xxx) to application.
Definition: TcpConnectionUtil.cc:341
virtual bool tryFastRoute(const Ptr< const TcpHeader > &tcpHeader)
Shortcut to process most common case as fast as possible.
Definition: TcpConnectionRcvSegment.cc:22
uint32_t irs
Definition: TcpConnection.h:160
L3Address remoteAddr
Definition: TcpConnection.h:347
@ TCP_E_RCV_ACK
Definition: TcpConnection.h:84
virtual uint32_t sendSegment(uint32_t bytes)
Utility: sends one segment of 'bytes' bytes from snd_nxt, and advances snd_nxt.
Definition: TcpConnectionUtil.cc:744
@ TCP_S_INIT
Definition: TcpConnection.h:47
virtual void process_OPEN_PASSIVE(TcpEventCode &event, TcpCommand *tcpCommand, cMessage *msg)
Definition: TcpConnectionEventProc.cc:70
static simsignal_t sndAckSignal
Definition: TcpConnection.h:321
bool seqLess(uint32_t a, uint32_t b)
Definition: TcpHeader.h:21
@ TCP_I_CONNECTION_RESET
Definition: TcpCommand_m.h:132
virtual void setConnection(TcpConnection *_conn)
Set the connection that owns this queue.
Definition: TcpSackRexmitQueue.h:51
bool ws_enabled
Definition: TcpConnection.h:198
bool ecnEchoState
Definition: TcpConnection.h:249
virtual void updateRcvQueueVars()
Utility: update receiver queue related variables and statistics - called before setting rcv_wnd.
Definition: TcpConnectionUtil.cc:1426
static simsignal_t sackedBytesSignal
Definition: TcpConnection.h:331
@ TCP_I_DATA_NOTIFICATION
Definition: TcpCommand_m.h:136
bool seqLE(uint32_t a, uint32_t b)
Definition: TcpHeader.h:22
@ TCP_E_TIMEOUT_2MSL
Definition: TcpConnection.h:94
@ TCP_I_URGENT_DATA
Definition: TcpCommand_m.h:126
@ TCP_S_FIN_WAIT_1
Definition: TcpConnection.h:55
virtual void init(uint32_t startSeq)
Set initial receive sequence number.
Definition: TcpReceiveQueue.cc:25
uint32_t dupthresh
Definition: TcpConnection.h:261
static simsignal_t rcvAdvSignal
Definition: TcpConnection.h:319
@ TCP_E_DESTROY
Definition: TcpConnection.h:76
cObject * createOne(const char *className, const char *defaultNamespace)
Like cObjectFactory::createOne(), except it starts searching for the class in the given namespace.
Definition: INETUtils.cc:147
static const char * optionName(int option)
Utility: returns name of TCPOPTION_xxx constants.
Definition: TcpConnectionUtil.cc:118
virtual void initConnection(TcpOpenCommand *openCmd)
Utility: creates send/receive queues and tcpAlgorithm.
Definition: TcpConnectionUtil.cc:407
bool isUnspecified() const
Definition: L3Address.cc:138
virtual uint32_t checkRexmitQueueForSackedOrRexmittedSegments(uint32_t fromSeq) const
Checks rexmit queue for sacked of rexmitted segments and returns a certain offset (contiguous sacked ...
Definition: TcpSackRexmitQueue.cc:266
uint32_t sackedBytes_old
Definition: TcpConnection.h:228
bool send_fin
Definition: TcpConnection.h:173
uint32_t snd_wnd
Definition: TcpConnection.h:150
#define TCP_MAX_WIN_SCALED
Definition: TcpConnection.h:112
virtual uint32_t getBytesAvailable(uint32_t fromSeq) const
Utility function: returns how many bytes are available in the queue, from (and including) the given s...
Definition: TcpSendQueue.cc:57
bool ts_enabled
Definition: TcpConnection.h:207
void setConnection(TcpConnection *_conn)
Assign this object to a TcpConnection.
Definition: TcpAlgorithm.h:52
int listeningSocketId
Definition: TcpConnection.h:341
@ TCP_C_SEND
Definition: TcpCommand_m.h:85
virtual void setConnection(TcpConnection *_conn)
Set the connection that owns this queue.
Definition: TcpSendQueue.h:48
virtual bool processAckInEstabEtc(Packet *tcpSegment, const Ptr< const TcpHeader > &tcpHeader)
Definition: TcpConnectionRcvSegment.cc:1127
@ TCP_E_RCV_UNEXP_SYN
Definition: TcpConnection.h:91
uint32_t end_seqno
Definition: TcpConnection.h:220
virtual TcpEventCode preanalyseAppCommandEvent(int commandCode)
Maps app command codes (msg kind of app command msgs) to TCP_E_xxx event codes.
Definition: TcpConnectionBase.cc:373
virtual void enqueueAppData(Packet *msg)
Called on SEND app command, it inserts in the queue the data the user wants to send.
Definition: TcpSendQueue.cc:38
bool snd_ws
Definition: TcpConnection.h:200
virtual void enqueueSentData(uint32_t fromSeqNum, uint32_t toSeqNum)
Inserts sent data to the rexmit queue.
Definition: TcpSackRexmitQueue.cc:78
virtual uint32_t getLE(uint32_t fromSeqNum)
Returns left edge of enqueued region.
Definition: TcpReceiveQueue.cc:130
virtual void discardUpTo(uint32_t seqNum)
Tells the queue that bytes up to (but NOT including) seqNum have been transmitted and ACKed,...
Definition: TcpSendQueue.cc:75
virtual TcpEventCode process_RCV_SEGMENT(Packet *tcpSegment, const Ptr< const TcpHeader > &tcpHeader, L3Address src, L3Address dest)
Process incoming TCP segment.
Definition: TcpConnectionRcvSegment.cc:78
static simsignal_t pipeSignal
Definition: TcpConnection.h:326
bool lossRecovery
Definition: TcpConnection.h:229
uint32_t snd_wl2
Definition: TcpConnection.h:153
@ TCP_E_OPEN_ACTIVE
Definition: TcpConnection.h:70
virtual void process_STATUS(TcpEventCode &event, TcpCommand *tcpCommand, cMessage *msg)
Definition: TcpConnectionEventProc.cc:283
uint32_t last_ack_sent
Definition: TcpConnection.h:211
value< double, units::s > s
Definition: Units.h:1235
const B TCP_OPTIONS_MAX_SIZE
Definition: TcpHeader_m.h:66
intscale< b, 1, 8 > B
Definition: Units.h:1168
virtual void process_SEND(TcpEventCode &event, TcpCommand *tcpCommand, cMessage *msg)
Definition: TcpConnectionEventProc.cc:112
SackList sacks_array
Definition: TcpConnection.h:223
virtual void init(uint32_t startSeq)
Initialize the object.
Definition: TcpSendQueue.cc:24
bool nagle_enabled
Definition: TcpConnection.h:179
short dscp
Definition: TcpConnection.h:354
virtual void ackSent()=0
Called after we sent an ACK.
virtual uint32_t getTSecr(const Ptr< const TcpHeader > &tcpHeader) const
Utility: get TSecr from segments TS header option.
Definition: TcpConnectionUtil.cc:1415
@ TCPOPTION_WINDOW_SCALE
Definition: TcpHeader_m.h:118
@ TCP_C_STATUS
Definition: TcpCommand_m.h:88
short tos
Definition: TcpConnection.h:355
@ TCP_S_LISTEN
Definition: TcpConnection.h:49
@ TCP_E_RCV_SYN
Definition: TcpConnection.h:85
virtual uint32_t getRE(uint32_t toSeqNum)
Returns right edge of enqueued region.
Definition: TcpReceiveQueue.cc:142
bool sndAck
Definition: TcpConnection.h:257
bool useDataNotification
Definition: Tcp.h:134
virtual void restartRexmitTimer()=0
Restart REXMIT timer.
Tcp * tcpMain
Definition: TcpConnection.h:358
if(cwndVector) cwndVector -> record(state->snd_cwnd)
int localPort
Definition: TcpConnection.h:349
simtime_t time_last_data_sent
Definition: TcpConnection.h:212
virtual void selectInitialSeqNum()
Utility: generates ISS and initializes corresponding state variables.
Definition: TcpConnectionUtil.cc:475
virtual void sendEstabIndicationToApp()
Utility: sends TCP_I_ESTABLISHED indication with TcpConnectInfo to application.
Definition: TcpConnectionUtil.cc:368
cMessage * connEstabTimer
Definition: TcpConnection.h:383
@ TCP_S_CLOSED
Definition: TcpConnection.h:48
virtual TcpSendQueue * createSendQueue()
To be called from TcpConnection: create a new send queue.
Definition: Tcp.cc:358
@ TCP_S_ESTABLISHED
Definition: TcpConnection.h:52
virtual uint32_t insertBytesFromSegment(Packet *tcpSegment, const Ptr< const TcpHeader > &tcpHeader)
Called when a TCP segment arrives, it should extract the payload from the segment and store it in the...
Definition: TcpReceiveQueue.cc:44
void insertTransportProtocolHeader(Packet *packet, const Protocol &protocol, const Ptr< TransportHeaderBase > &header)
Definition: L4Tools.cc:77
@ TCP_S_SYN_RCVD
Definition: TcpConnection.h:51
uint32_t snd_fin_seq
Definition: TcpConnection.h:174
uint32_t tcpRcvQueueDrops
Definition: TcpConnection.h:246
@ TCP_C_READ
Definition: TcpCommand_m.h:90
removed HopLimitReq
Definition: IUdp-gates.txt:11
static simsignal_t tcpRcvQueueDropsSignal
Definition: TcpConnection.h:333
virtual void sendToIP(Packet *tcpSegment, const Ptr< TcpHeader > &tcpHeader)
Utility: adds control info to segment and sends it to IP.
Definition: TcpConnectionUtil.cc:246
uint32_t snd_sacks
Definition: TcpConnection.h:237
bool ect
Definition: TcpConnection.h:253
virtual void sendSynAck()
Utility: send SYN+ACK.
Definition: TcpConnectionUtil.cc:581
bool afterRto
Definition: TcpConnection.h:194
@ TCP_E_SEND
Definition: TcpConnection.h:73
virtual void configureStateVariables()
Utility: set snd_mss, rcv_wnd and sack in newly created state variables block.
Definition: TcpConnectionUtil.cc:436
#define MAX_SYN_REXMIT_COUNT
Definition: TcpConnection.h:110
virtual void discardUpTo(uint32_t seqNum)
Tells the queue that bytes up to (but NOT including) seqNum have been transmitted and ACKed,...
Definition: TcpSackRexmitQueue.cc:56
bool seqGE(uint32_t a, uint32_t b)
Definition: TcpHeader.h:24
virtual void process_OPTIONS(TcpEventCode &event, TcpCommand *tcpCommand, cMessage *msg)
Definition: TcpConnectionEventProc.cc:172
#define TCP_TIMEOUT_SYN_REXMIT
Definition: TcpConnection.h:106
virtual bool processWSOption(const Ptr< const TcpHeader > &tcpHeader, const TcpOptionWindowScale &option)
Definition: TcpConnectionUtil.cc:1149
static simsignal_t rcvSeqSignal
Definition: TcpConnection.h:322
@ TCP_E_STATUS
Definition: TcpConnection.h:77
@ TCP_C_OPEN_PASSIVE
Definition: TcpCommand_m.h:83
int socketId
Definition: TcpConnection.h:337
virtual void setConnection(TcpConnection *_conn)
Set the connection that owns this queue.
Definition: TcpReceiveQueue.h:67
uint32_t snd_nxt
Definition: TcpConnection.h:148
@ TCP_S_CLOSE_WAIT
Definition: TcpConnection.h:53
bool sack_enabled
Definition: TcpConnection.h:216
bool ts_support
Definition: TcpConnection.h:206
virtual uint32_t getAmountOfSackedBytes(uint32_t seqNum) const
Returns amount of sacked bytes above seqNum.
Definition: TcpSackRexmitQueue.cc:314
@ TCP_S_TIME_WAIT
Definition: TcpConnection.h:58
uint32_t snd_wl1
Definition: TcpConnection.h:152
#define PAWS_IDLE_TIME_THRESH
Definition: TcpConnection.h:114
virtual void printConnBrief() const
Utility: prints local/remote addr/port and app gate index/socketId.
Definition: TcpConnectionUtil.cc:147
bool ecnSynSent
Definition: TcpConnection.h:255
virtual uint32_t getBufferEndSeq() const
Returns the sequence number of the last byte stored in the buffer plus one.
Definition: TcpSackRexmitQueue.h:82
removed DscpReq kind
Definition: IUdp-gates.txt:12
static simsignal_t unackedSignal
Definition: TcpConnection.h:324
#define TCP_MAX_WIN
Definition: TcpConnection.h:111
static simsignal_t rcvNASegSignal
Definition: TcpConnection.h:330
uint32_t maxRcvBuffer
Definition: TcpConnection.h:243
uint32_t rcv_oooseg
Definition: TcpConnection.h:239
int remotePort
Definition: TcpConnection.h:350
simtime_t syn_rexmit_timeout
Definition: TcpConnection.h:166
const B TCP_OPTION_SACK_ENTRY_SIZE
Definition: TcpHeader_m.h:69
virtual uint32_t getHighestSackedSeqNum() const
Returns the highest sequence number sacked by data receiver.
Definition: TcpSackRexmitQueue.cc:246
virtual void sendCommandInvoked()=0
Called after user sent TCP_C_SEND command to us.
virtual uint32_t getQueueLength()
Returns the number of blocks currently buffered in queue.
Definition: TcpReceiveQueue.cc:120
@ TCP_C_CLOSE
Definition: TcpCommand_m.h:86
@ TCPOPTION_MAXIMUM_SEGMENT_SIZE
Definition: TcpHeader_m.h:117
virtual unsigned short updateRcvWnd()
Utility: update receive window (rcv_wnd), and calculate scaled value if window scaling enabled.
Definition: TcpConnectionUtil.cc:1438
static const char * eventName(int event)
Utility: returns name of TCP_E_xxx constants.
Definition: TcpConnectionUtil.cc:65
uint32_t highRxt
Definition: TcpConnection.h:224
static const char * indicationName(int code)
Utility: returns name of TCP_I_xxx constants.
Definition: TcpConnectionUtil.cc:96
virtual bool nextSeg(uint32_t &seqNum)
For SACK TCP.
Definition: TcpConnectionSackUtil.cc:208
static simsignal_t dupAcksSignal
Definition: TcpConnection.h:325
virtual uint32_t getFirstSeqNo()
Returns the minimum of first byte seq.no.
Definition: TcpReceiveQueue.cc:154
@ TCPOPTION_TIMESTAMP
Definition: TcpHeader_m.h:121
@ TCP_C_ABORT
Definition: TcpCommand_m.h:87
virtual void segmentRetransmitted(uint32_t fromseq, uint32_t toseq)=0
Called after we retransmitted segment.
virtual uint32_t getHighestRexmittedSeqNum() const
Returns the highest sequence number rexmitted by data sender.
Definition: TcpSackRexmitQueue.cc:256
uint32_t snd_mss
Definition: TcpConnection.h:142
@ TCP_C_DESTROY
Definition: TcpCommand_m.h:91
virtual void receivedAckForDataNotYetSent(uint32_t seq)=0
Called after we received an ACK for data not yet sent.
bool fork
Definition: TcpConnection.h:140
virtual uint32_t getBufferEndSeq() const
Returns the sequence number of the last byte stored in the buffer plus one.
Definition: TcpSendQueue.cc:52
int ttl
Definition: TcpConnection.h:353
static void printSegmentBrief(Packet *tcpSegment, const Ptr< const TcpHeader > &tcpHeader)
Utility: prints important header fields.
Definition: TcpConnectionUtil.cc:156
virtual bool processSACKOption(const Ptr< const TcpHeader > &tcpHeader, const TcpOptionSack &option)
Definition: TcpConnectionSackUtil.cc:29
virtual void process_CLOSE(TcpEventCode &event, TcpCommand *tcpCommand, cMessage *msg)
Definition: TcpConnectionEventProc.cc:190
virtual void readHeaderOptions(const Ptr< const TcpHeader > &tcpHeader)
Utility: readHeaderOptions (Currently only EOL, NOP, MSS, WS, SACK_PERMITTED, SACK and TS are impleme...
Definition: TcpConnectionUtil.cc:1062
virtual TcpEventCode processRstInSynReceived(const Ptr< const TcpHeader > &tcpHeader)
Definition: TcpConnectionRcvSegment.cc:1096
virtual void receivedDataAck(uint32_t firstSeqAcked)=0
Called after we received an ACK which acked some data (that is, we could advance snd_una).
cFSM fsm
Definition: TcpConnection.h:361
virtual void init(uint32_t seqNum)
Initialize the object.
Definition: TcpSackRexmitQueue.cc:26
#define Enter_Method(...)
Definition: SelfDoc.h:71
bool queueUpdate
Definition: TcpConnection.h:233
virtual void processEcnInEstablished()=0
Called before processing segment in established state.
bool increased_IW_enabled
Definition: TcpConnection.h:182
int syn_rexmit_count
Definition: TcpConnection.h:165
bool fin_rcvd
Definition: TcpConnection.h:176
virtual TcpEventCode processSynInListen(Packet *tcpSegment, const Ptr< const TcpHeader > &tcpHeader, L3Address srcAddr, L3Address destAddr)
Definition: TcpConnectionRcvSegment.cc:799
virtual void sendFromConn(cMessage *msg, const char *gatename, int gateindex=-1)
Definition: Tcp.cc:118
uint rcv_wnd_scale
Definition: TcpConnection.h:202
virtual void sendFin()
Utility: sends FIN.
Definition: TcpConnectionUtil.cc:724
virtual uint32_t getAmountOfFreeBytes(uint32_t maxRcvBuffer)
Returns the number of bytes currently free (=available) in queue.
Definition: TcpReceiveQueue.cc:113
static simsignal_t tcpConnectionAddedSignal
Definition: Tcp.h:87
static simsignal_t sndSacksSignal
Definition: TcpConnection.h:327
cMessage * synRexmitTimer
Definition: TcpConnection.h:385
virtual TcpEventCode processSegmentInSynSent(Packet *tcpSegment, const Ptr< const TcpHeader > &tcpHeader, L3Address src, L3Address dest)
Definition: TcpConnectionRcvSegment.cc:872
bool sndCwr
Definition: TcpConnection.h:250
const B TCP_OPTION_TS_SIZE
Definition: TcpHeader_m.h:70
uint32_t sendQueueLimit
Definition: TcpConnection.h:232
TcpEventCode
Definition: TcpConnection.h:65
virtual void sendAvailableIndicationToApp()
Utility: sends TCP_I_AVAILABLE indication with TcpAvailableInfo to application.
Definition: TcpConnectionUtil.cc:352
virtual void checkSackBlock(uint32_t seqNum, uint32_t &length, bool &sacked, bool &rexmitted) const
Definition: TcpSackRexmitQueue.cc:362
@ TCP_E_ABORT
Definition: TcpConnection.h:75
static simsignal_t rcvOooSegSignal
Definition: TcpConnection.h:329
virtual void process_TIMEOUT_2MSL()
Definition: TcpConnectionRcvSegment.cc:1295
virtual void process_TIMEOUT_SYN_REXMIT(TcpEventCode &event)
Definition: TcpConnectionRcvSegment.cc:1339
virtual TcpEventCode processSegmentInListen(Packet *tcpSegment, const Ptr< const TcpHeader > &tcpHeader, L3Address src, L3Address dest)
Definition: TcpConnectionRcvSegment.cc:724
@ TCP_E_ACCEPT
Definition: TcpConnection.h:72
virtual uint32_t getTotalAmountOfSackedBytes() const
Returns total amount of sacked bytes.
Definition: TcpSackRexmitQueue.cc:302
IL3AddressType * getAddressType() const
Definition: L3Address.cc:59
virtual void sendRstAck(uint32_t seq, uint32_t ack, L3Address src, L3Address dest, int srcPort, int destPort)
Utility: sends RST+ACK; does not use connection state.
Definition: TcpConnectionUtil.cc:655
@ TCPOPTION_END_OF_OPTION_LIST
Definition: TcpHeader_m.h:115
bool snd_sack_perm
Definition: TcpConnection.h:217
static simsignal_t tcpRcvQueueBytesSignal
Definition: TcpConnection.h:332
uint32_t rcv_nxt
Definition: TcpConnection.h:157
bool rcv_sack_perm
Definition: TcpConnection.h:218
bool ack_now
Definition: TcpConnection.h:185
@ TCP_E_CLOSE
Definition: TcpConnection.h:74
uint32_t rcv_adv
Definition: TcpConnection.h:161
@ TCP_E_RCV_FIN
Definition: TcpConnection.h:87
virtual void receiveSeqChanged()=0
Called after rcv_nxt got advanced, either because we received in-sequence data ("text" in RFC 793 lin...
@ TCP_E_READ
Definition: TcpConnection.h:79
@ TCPOPTION_SACK
Definition: TcpHeader_m.h:120
static uint32_t convertSimtimeToTS(simtime_t simtime)
Utility: converts a given simtime to a timestamp (TS).
Definition: TcpConnectionUtil.cc:1589
uint snd_wnd_scale
Definition: TcpConnection.h:203
@ TCP_S_LAST_ACK
Definition: TcpConnection.h:54
bool rcv_initial_ts
Definition: TcpConnection.h:209
@ TCP_I_STATUS
Definition: TcpCommand_m.h:134
bool ecnWillingness
Definition: TcpConnection.h:256
virtual bool hasEnoughSpaceForSegmentInReceiveQueue(Packet *tcpSegment, const Ptr< const TcpHeader > &tcpHeader)
Utility: returns true when receive queue has enough space for store the tcpHeader.
Definition: TcpConnectionRcvSegment.cc:109
bool gotEce
Definition: TcpConnection.h:251
unsigned int uint
Definition: INETDefs.h:55
@ TCP_E_RCV_DATA
Definition: TcpConnection.h:83
virtual bool processMSSOption(const Ptr< const TcpHeader > &tcpHeader, const TcpOptionMaxSegmentSize &option)
Definition: TcpConnectionUtil.cc:1114
@ TCP_E_TIMEOUT_FIN_WAIT_2
Definition: TcpConnection.h:96
@ TCP_I_DATA
Definition: TcpCommand_m.h:125
virtual void process_QUEUE_BYTES_LIMIT(TcpEventCode &event, TcpCommand *tcpCommand, cMessage *msg)
Definition: TcpConnectionEventProc.cc:320
virtual void process_ACCEPT(TcpEventCode &event, TcpCommand *tcpCommand, cMessage *msg)
Definition: TcpConnectionEventProc.cc:102
static simsignal_t sndNxtSignal
Definition: TcpConnection.h:320
virtual uint32_t getAmountOfBufferedBytes()
Returns the number of bytes (out-of-order-segments) currently buffered in queue.
Definition: TcpReceiveQueue.cc:103
@ TCP_S_CLOSING
Definition: TcpConnection.h:57
@ TCP_E_QUEUE_BYTES_LIMIT
Definition: TcpConnection.h:78
uint32_t snd_una
Definition: TcpConnection.h:147
bool active
Definition: TcpConnection.h:139
cMessage * the2MSLTimer
Definition: TcpConnection.h:382
@ TCP_S_SYN_SENT
Definition: TcpConnection.h:50
bool snd_sack
Definition: TcpConnection.h:221
uint32_t rcv_up
Definition: TcpConnection.h:159
bool endPointIsWillingECN
Definition: TcpConnection.h:254
static const char * stateName(int state)
Utility: returns name of TCP_S_xxx constants.
Definition: TcpConnectionUtil.cc:42
virtual bool processSACKPermittedOption(const Ptr< const TcpHeader > &tcpHeader, const TcpOptionSackPermitted &option)
Definition: TcpConnectionUtil.cc:1222
uint32_t usedRcvBuffer
Definition: TcpConnection.h:244
virtual bool shouldMarkAck()=0
Called before sending ACK.
TcpSackRexmitQueue * rexmitQueue
Definition: TcpConnection.h:373
L3Address localAddr
Definition: TcpConnection.h:345
uint32_t rcv_fin_seq
Definition: TcpConnection.h:177
const B TCP_MIN_HEADER_LENGTH
Definition: TcpHeader_m.h:63
@ TCP_I_SEND_MSG
Definition: TcpCommand_m.h:135
uint32_t pipe
Definition: TcpConnection.h:225
virtual void sendAvailableDataToApp()
Utility: sends data or data notification to application.
Definition: TcpConnectionUtil.cc:387
bool seqGreater(uint32_t a, uint32_t b)
Definition: TcpHeader.h:23
@ TCPOPTION_NO_OPERATION
Definition: TcpHeader_m.h:116
virtual TcpHeader writeHeaderOptions(const Ptr< TcpHeader > &tcpHeader)
Utility: writeHeaderOptions (Currently only EOL, NOP, MSS, WS, SACK_PERMITTED, SACK and TS are implem...
Definition: TcpConnectionUtil.cc:1240
uint32_t iss
Definition: TcpConnection.h:154
virtual void stateEntered(int state, int oldState, TcpEventCode event)
Perform cleanup necessary when entering a new state, e.g.
Definition: TcpConnectionBase.cc:692
uint32_t snd_up
Definition: TcpConnection.h:151
virtual ushort getEphemeralPort()
To be called from TcpConnection: reserves an ephemeral port for the connection.
Definition: Tcp.cc:274
virtual void sendSyn()
Utility: send SYN.
Definition: TcpConnectionUtil.cc:538
TcpStateVariables * getStateVariables()
Creates and returns the TCP state variables.
Definition: TcpAlgorithm.h:57
@ TCP_E_RCV_RST
Definition: TcpConnection.h:89
@ TCP_S_FIN_WAIT_2
Definition: TcpConnection.h:56
@ IP_ECN_ECT_1
Definition: EcnTag_m.h:60
int getMsl()
Definition: Tcp.h:198
virtual uint32_t getNumOfDiscontiguousSacks(uint32_t seqNum) const
Returns the number of discontiguous sacked regions (SACKed sequences) above seqNum.
Definition: TcpSackRexmitQueue.cc:335
virtual void updateWndInfo(const Ptr< const TcpHeader > &tcpHeader, bool doAlways=false)
Utility: update window information (snd_wnd, snd_wl1, snd_wl2)
Definition: TcpConnectionUtil.cc:1486
@ TCP_E_OPEN_PASSIVE
Definition: TcpConnection.h:71
uint32_t snd_max
Definition: TcpConnection.h:149
bool rexmit
Definition: TcpConnection.h:258
const B TCP_OPTION_SACK_MIN_SIZE
Definition: TcpHeader_m.h:68
virtual void addSockPair(TcpConnection *conn, L3Address localAddr, L3Address remoteAddr, int localPort, int remotePort)
To be called from TcpConnection when a new connection gets created, during processing of OPEN_ACTIVE ...
Definition: Tcp.cc:304
@ TCP_I_CONNECTION_REFUSED
Definition: TcpCommand_m.h:131
@ TCP_C_OPEN_ACTIVE
Definition: TcpCommand_m.h:82
bool delayed_acks_enabled
Definition: TcpConnection.h:180