INET Framework for OMNeT++/OMNEST
inet::tcp::TcpLwipConnection Class Reference

Module for representing a connection in TcpLwip stack. More...

#include <TcpLwipConnection.h>

Inheritance diagram for inet::tcp::TcpLwipConnection:

Public Member Functions

 TcpLwipConnection ()
 
 ~TcpLwipConnection ()
 
void initConnection (TcpLwip &tcpLwipP, int connIdP)
 
void initConnection (TcpLwipConnection &tcpLwipConnectionP, int connIdP, LwipTcpLayer::tcp_pcb *pcbP)
 
void sendAvailableIndicationToApp (int listenConnId)
 Utility: sends TCP_I_AVAILABLE indication with TcpAvailableInfo to application. More...
 
void sendEstablishedMsg ()
 
void sendIndicationToApp (int code)
 
void notifyAboutSending (const TcpHeader &tcpsegP)
 
void do_SEND ()
 
bool isSendUpEnabled ()
 
void sendUpData ()
 
void processAppCommand (cMessage *msgP)
 

Static Public Member Functions

static const char * indicationName (int code)
 

Public Attributes

int connIdM
 
LwipTcpLayer::tcp_pcb * pcbM = nullptr
 
TcpLwipSendQueuesendQueueM = nullptr
 
TcpLwipReceiveQueuereceiveQueueM = nullptr
 
TcpLwiptcpLwipM = nullptr
 

Protected Member Functions

 TcpLwipConnection (const TcpLwipConnection &)
 
void listen (const L3Address &localAddr, unsigned short localPort)
 
void connect (const L3Address &localAddr, unsigned short localPort, const L3Address &remoteAddr, unsigned short remotePort)
 
void close ()
 
void abort ()
 
void accept ()
 
void send (Packet *msgP)
 
int send_data (void *data, int len)
 
void recordSend (const TcpHeader &tcpsegP)
 
void recordReceive (const TcpHeader &tcpsegP)
 
void process_OPEN_ACTIVE (TcpOpenCommand *tcpCommandP, cMessage *msgP)
 
void process_OPEN_PASSIVE (TcpOpenCommand *tcpCommandP, cMessage *msgP)
 
void process_ACCEPT (TcpAcceptCommand *tcpCommand, cMessage *msg)
 
void process_SEND (Packet *msgP)
 
void process_CLOSE (TcpCommand *tcpCommandP, cMessage *msgP)
 
void process_ABORT (TcpCommand *tcpCommandP, cMessage *msgP)
 
void process_STATUS (TcpCommand *tcpCommandP, cMessage *msgP)
 
void fillStatusInfo (TcpStatusInfo &statusInfo)
 

Protected Attributes

long int totalSentM = 0
 
bool isListenerM = false
 
bool onCloseM = false
 
bool sendUpEnabled = false
 

Static Protected Attributes

static simsignal_t sndWndSignal = registerSignal("sndWnd")
 
static simsignal_t sndNxtSignal = registerSignal("sndNxt")
 
static simsignal_t sndAckSignal = registerSignal("sndAck")
 
static simsignal_t rcvWndSignal = registerSignal("rcvWnd")
 
static simsignal_t rcvSeqSignal = registerSignal("rcvSeq")
 
static simsignal_t rcvAckSignal = registerSignal("rcvAck")
 

Detailed Description

Module for representing a connection in TcpLwip stack.

Constructor & Destructor Documentation

◆ TcpLwipConnection() [1/2]

inet::tcp::TcpLwipConnection::TcpLwipConnection ( const TcpLwipConnection )
protected

◆ TcpLwipConnection() [2/2]

inet::tcp::TcpLwipConnection::TcpLwipConnection ( )
inline
34 {}

◆ ~TcpLwipConnection()

inet::tcp::TcpLwipConnection::~TcpLwipConnection ( )
86 {
87  delete receiveQueueM;
88  delete sendQueueM;
89  if (pcbM) {
90  pcbM->callback_arg = nullptr;
91  tcpLwipM->getLwipTcpLayer()->tcp_pcb_purge(pcbM);
92  memp_free(MEMP_TCP_PCB, pcbM);
93  pcbM = nullptr;
94  }
95 }

Member Function Documentation

◆ abort()

void inet::tcp::TcpLwipConnection::abort ( )
protected
238 {
239  tcpLwipM->getLwipTcpLayer()->tcp_abandon(pcbM, false);
240  onCloseM = false;
241 }

Referenced by process_ABORT().

◆ accept()

void inet::tcp::TcpLwipConnection::accept ( )
protected
244 {
245  if (sendUpEnabled)
246  throw cRuntimeError("socket already accepted/not a fork of a listening socket");
248  do_SEND();
249 }

Referenced by process_ACCEPT().

◆ close()

void inet::tcp::TcpLwipConnection::close ( )
protected
228 {
229  onCloseM = true;
230 
231  if (0 == sendQueueM->getBytesAvailable()) {
232  tcpLwipM->getLwipTcpLayer()->tcp_close(pcbM);
233  onCloseM = false;
234  }
235 }

Referenced by process_CLOSE().

◆ connect()

void inet::tcp::TcpLwipConnection::connect ( const L3Address localAddr,
unsigned short  localPort,
const L3Address remoteAddr,
unsigned short  remotePort 
)
protected
216 {
217  onCloseM = false;
218  struct ip_addr src_addr;
219  src_addr.addr = localAddr;
220  struct ip_addr dest_addr;
221  dest_addr.addr = remoteAddr;
222  tcpLwipM->getLwipTcpLayer()->tcp_bind(pcbM, &src_addr, localPort);
223  tcpLwipM->getLwipTcpLayer()->tcp_connect(pcbM, &dest_addr, (u16_t)remotePort, nullptr);
224  totalSentM = 0;
225 }

Referenced by process_OPEN_ACTIVE().

◆ do_SEND()

void inet::tcp::TcpLwipConnection::do_SEND ( )
307 {
308  if (!sendUpEnabled)
309  return;
310  char buffer[8 * 536];
311  int bytes;
312  int allsent = 0;
313 
314  while (0 != (bytes = sendQueueM->getBytesForTcpLayer(buffer, sizeof(buffer)))) {
315  int sent = send_data(buffer, bytes);
316 
317  if (sent > 0) {
319  allsent += sent;
320  }
321  else {
322  if (sent != ERR_MEM)
323  EV_ERROR << "TcpLwip connection: " << connIdM << ": Error do sending, err is " << sent << endl;
324  break;
325  }
326  }
327 
328  totalSentM += allsent;
329  EV_DETAIL << "do_SEND(): " << connIdM
330  << " send:" << allsent
331  << ", unsent:" << sendQueueM->getBytesAvailable()
332  << ", total sent:" << totalSentM
333  << ", all bytes:" << totalSentM + sendQueueM->getBytesAvailable()
334  << endl;
335 
336  if (onCloseM && (0 == sendQueueM->getBytesAvailable())) {
337  tcpLwipM->getLwipTcpLayer()->tcp_close(pcbM);
338  onCloseM = false;
339  }
340 }

Referenced by accept(), sendEstablishedMsg(), inet::tcp::TcpLwip::tcp_event_conn(), inet::tcp::TcpLwip::tcp_event_poll(), inet::tcp::TcpLwip::tcp_event_recv(), and inet::tcp::TcpLwip::tcp_event_sent().

◆ fillStatusInfo()

void inet::tcp::TcpLwipConnection::fillStatusInfo ( TcpStatusInfo statusInfo)
protected
176 {
177  // TODO statusInfo.setState(fsm.getState());
178  // TODO statusInfo.setStateName(stateName(fsm.getState()));
179 
180  statusInfo.setLocalAddr((pcbM->local_ip.addr));
181  statusInfo.setLocalPort(pcbM->local_port);
182  statusInfo.setRemoteAddr((pcbM->remote_ip.addr));
183  statusInfo.setRemotePort(pcbM->remote_port);
184 
185  statusInfo.setSnd_mss(pcbM->mss);
186  // TODO statusInfo.setSnd_una(pcbM->snd_una);
187  statusInfo.setSnd_nxt(pcbM->snd_nxt);
188  // TODO statusInfo.setSnd_max(pcbM->snd_max);
189  statusInfo.setSnd_wnd(pcbM->snd_wnd);
190  // TODO statusInfo.setSnd_up(pcbM->snd_up);
191  statusInfo.setSnd_wl1(pcbM->snd_wl1);
192  statusInfo.setSnd_wl2(pcbM->snd_wl2);
193  // TODO statusInfo.setIss(pcbM->iss);
194  statusInfo.setRcv_nxt(pcbM->rcv_nxt);
195  statusInfo.setRcv_wnd(pcbM->rcv_wnd);
196  // TODO statusInfo.setRcv_up(pcbM->rcv_up);
197  // TODO statusInfo.setIrs(pcbM->irs);
198  // TODO statusInfo.setFin_ack_rcvd(pcbM->fin_ack_rcvd);
199 }

Referenced by process_STATUS().

◆ indicationName()

const char * inet::tcp::TcpLwipConnection::indicationName ( int  code)
static
141 {
142 #define CASE(x) case x: \
143  s = #x; s += 6; break
144  const char *s = "unknown";
145 
146  switch (code) {
147  CASE(TCP_I_DATA);
157  }
158 
159  return s;
160 #undef CASE
161 }

Referenced by sendAvailableIndicationToApp(), and sendIndicationToApp().

◆ initConnection() [1/2]

void inet::tcp::TcpLwipConnection::initConnection ( TcpLwip tcpLwipP,
int  connIdP 
)
53 {
54  connIdM = connIdP;
55  sendQueueM = tcpLwipP.createSendQueue();
56  receiveQueueM = tcpLwipP.createReceiveQueue();
57  tcpLwipM = &tcpLwipP;
58  totalSentM = 0;
59  isListenerM = false;
60  onCloseM = false;
61  ASSERT(!pcbM);
62  pcbM = tcpLwipM->getLwipTcpLayer()->tcp_new(); // FIXME memory leak
63  ASSERT(pcbM);
64  pcbM->callback_arg = this;
67 }

Referenced by inet::tcp::TcpLwip::handleUpperCommand().

◆ initConnection() [2/2]

void inet::tcp::TcpLwipConnection::initConnection ( TcpLwipConnection tcpLwipConnectionP,
int  connIdP,
LwipTcpLayer::tcp_pcb *  pcbP 
)
70 {
71  connIdM = connIdP;
72  sendQueueM = check_and_cast<TcpLwipSendQueue *>(inet::utils::createOne(connP.sendQueueM->getClassName()));
73  receiveQueueM = check_and_cast<TcpLwipReceiveQueue *>(inet::utils::createOne(connP.receiveQueueM->getClassName()));
74  tcpLwipM = connP.tcpLwipM;
75  totalSentM = 0;
76  isListenerM = false;
77  onCloseM = false;
78  ASSERT(!pcbM);
79  pcbM = pcbP;
80  pcbM->callback_arg = this;
83 }

◆ isSendUpEnabled()

bool inet::tcp::TcpLwipConnection::isSendUpEnabled ( )
inline
53 { return sendUpEnabled; }

◆ listen()

void inet::tcp::TcpLwipConnection::listen ( const L3Address localAddr,
unsigned short  localPort 
)
protected
202 {
203  onCloseM = false;
204  tcpLwipM->getLwipTcpLayer()->tcp_bind(pcbM, nullptr, localPort);
205  // The next returns a tcp_pcb: need to do some research on how
206  // it works; does it actually accept a connection as well? It
207  // shouldn't, as there is a tcp_accept
208  LwipTcpLayer::tcp_pcb *pcb = pcbM;
209  pcbM = nullptr; // unlink old pcb from this, otherwise lwip_free_pcb_event destroy this conn.
210  pcbM = tcpLwipM->getLwipTcpLayer()->tcp_listen(pcb);
211  totalSentM = 0;
212 }

Referenced by process_OPEN_PASSIVE().

◆ notifyAboutSending()

void inet::tcp::TcpLwipConnection::notifyAboutSending ( const TcpHeader tcpsegP)
257 {
259  recordSend(tcpsegP);
260 }

Referenced by inet::tcp::TcpLwip::ip_output().

◆ process_ABORT()

void inet::tcp::TcpLwipConnection::process_ABORT ( TcpCommand tcpCommandP,
cMessage *  msgP 
)
protected
463 {
464  EV_INFO << this << ": processing ABORT(" << connIdM << ") command\n";
465  delete tcpCommandP;
466  delete msgP;
467  abort();
468 }

Referenced by processAppCommand().

◆ process_ACCEPT()

void inet::tcp::TcpLwipConnection::process_ACCEPT ( TcpAcceptCommand tcpCommand,
cMessage *  msg 
)
protected
442 {
443  accept();
444  delete tcpCommand;
445  delete msg;
446 }

Referenced by processAppCommand().

◆ process_CLOSE()

void inet::tcp::TcpLwipConnection::process_CLOSE ( TcpCommand tcpCommandP,
cMessage *  msgP 
)
protected
455 {
456  EV_INFO << this << ": processing CLOSE(" << connIdM << ") command\n";
457  delete tcpCommandP;
458  delete msgP;
459  close();
460 }

Referenced by processAppCommand().

◆ process_OPEN_ACTIVE()

void inet::tcp::TcpLwipConnection::process_OPEN_ACTIVE ( TcpOpenCommand tcpCommandP,
cMessage *  msgP 
)
protected
404 {
405  ASSERT(tcpLwipM->getLwipTcpLayer());
406 
407  if (tcpCommandP->getRemoteAddr().isUnspecified() || tcpCommandP->getRemotePort() == -1)
408  throw cRuntimeError("Error processing command OPEN_ACTIVE: remote address and port must be specified");
409 
410  int localPort = tcpCommandP->getLocalPort();
411  if (localPort == -1)
412  localPort = 0;
413 
414  EV_INFO << this << ": OPEN: "
415  << tcpCommandP->getLocalAddr() << ":" << localPort << " --> "
416  << tcpCommandP->getRemoteAddr() << ":" << tcpCommandP->getRemotePort() << "\n";
417  connect(tcpCommandP->getLocalAddr(), localPort,
418  tcpCommandP->getRemoteAddr(), tcpCommandP->getRemotePort());
419  delete tcpCommandP;
420  delete msgP;
421 }

Referenced by processAppCommand().

◆ process_OPEN_PASSIVE()

void inet::tcp::TcpLwipConnection::process_OPEN_PASSIVE ( TcpOpenCommand tcpCommandP,
cMessage *  msgP 
)
protected
425 {
426  ASSERT(tcpLwipM->getLwipTcpLayer());
427 
428  if (tcpCommandP->getFork() == false)
429  throw cRuntimeError("Error processing command OPEN_PASSIVE: non-forking listening connections are not supported yet");
430 
431  if (tcpCommandP->getLocalPort() == -1)
432  throw cRuntimeError("Error processing command OPEN_PASSIVE: local port must be specified");
433 
434  EV_INFO << this << "Starting to listen on: " << tcpCommandP->getLocalAddr() << ":"
435  << tcpCommandP->getLocalPort() << "\n";
436  listen(tcpCommandP->getLocalAddr(), tcpCommandP->getLocalPort());
437  delete tcpCommandP;
438  delete msgP;
439 }

Referenced by processAppCommand().

◆ process_SEND()

void inet::tcp::TcpLwipConnection::process_SEND ( Packet msgP)
protected
449 {
450  EV_INFO << this << ": processing SEND command, len=" << msgP->getByteLength() << endl;
451  send(msgP);
452 }

Referenced by processAppCommand().

◆ process_STATUS()

void inet::tcp::TcpLwipConnection::process_STATUS ( TcpCommand tcpCommandP,
cMessage *  msgP 
)
protected
471 {
472  EV_INFO << this << ": processing STATUS(" << connIdM << ") command\n";
473  delete tcpCommandP; // but we'll reuse msg for reply
474  TcpStatusInfo *statusInfo = new TcpStatusInfo();
475  fillStatusInfo(*statusInfo);
476  msgP->setControlInfo(statusInfo);
477  msgP->setKind(TCP_I_STATUS);
478  tcpLwipM->send(msgP, "appOut");
479 }

Referenced by processAppCommand().

◆ processAppCommand()

void inet::tcp::TcpLwipConnection::processAppCommand ( cMessage *  msgP)
362 {
363  // first do actions
364  TcpCommand *tcpCommand = check_and_cast_nullable<TcpCommand *>(msgP->removeControlInfo());
365 
366  switch (msgP->getKind()) {
367  case TCP_C_OPEN_ACTIVE:
368  process_OPEN_ACTIVE(check_and_cast<TcpOpenCommand *>(tcpCommand), msgP);
369  break;
370 
371  case TCP_C_OPEN_PASSIVE:
372  process_OPEN_PASSIVE(check_and_cast<TcpOpenCommand *>(tcpCommand), msgP);
373  break;
374 
375  case TCP_C_ACCEPT:
376  process_ACCEPT(check_and_cast<TcpAcceptCommand *>(tcpCommand), msgP);
377  break;
378 
379  case TCP_C_SEND:
380  process_SEND(check_and_cast<Packet *>(msgP));
381  break;
382 
383  case TCP_C_CLOSE:
384  ASSERT(tcpCommand);
385  process_CLOSE(tcpCommand, msgP);
386  break;
387 
388  case TCP_C_ABORT:
389  ASSERT(tcpCommand);
390  process_ABORT(tcpCommand, msgP);
391  break;
392 
393  case TCP_C_STATUS:
394  ASSERT(tcpCommand);
395  process_STATUS(tcpCommand, msgP);
396  break;
397 
398  default:
399  throw cRuntimeError("Wrong command from app: %d", msgP->getKind());
400  }
401 }

Referenced by inet::tcp::TcpLwip::handleUpperCommand().

◆ recordReceive()

void inet::tcp::TcpLwipConnection::recordReceive ( const TcpHeader tcpsegP)
protected
44 {
45  emit(rcvWndSignal, tcpsegP.getWindow());
46  emit(rcvSeqSignal, tcpsegP.getSequenceNo());
47 
48  if (tcpsegP.getAckBit())
49  emit(rcvAckSignal, tcpsegP.getAckNo());
50 }

◆ recordSend()

void inet::tcp::TcpLwipConnection::recordSend ( const TcpHeader tcpsegP)
protected
35 {
36  emit(sndWndSignal, tcpsegP.getWindow());
37  emit(sndNxtSignal, tcpsegP.getSequenceNo());
38 
39  if (tcpsegP.getAckBit())
40  emit(sndAckSignal, tcpsegP.getAckNo());
41 }

Referenced by notifyAboutSending().

◆ send()

void inet::tcp::TcpLwipConnection::send ( Packet msgP)
protected
252 {
253  sendQueueM->enqueueAppData(msgP);
254 }

Referenced by process_SEND().

◆ send_data()

int inet::tcp::TcpLwipConnection::send_data ( void *  data,
int  len 
)
protected
263 {
264  int error;
265  int written = 0;
266 
267  if (datalen > 0xFFFF)
268  datalen = 0xFFFF; // tcp_write() length argument is uint16_t
269 
270  u32_t ss = pcbM->snd_lbb;
271  error = tcpLwipM->getLwipTcpLayer()->tcp_write(pcbM, data, datalen, 1);
272 
273  if (error == ERR_OK) {
274  written = datalen;
275  }
276  else if (error == ERR_MEM) {
277  // Chances are that datalen is too large to fit in the send
278  // buffer. If it is really large (larger than a typical MSS,
279  // say), we should try segmenting the data ourselves.
280  while (1) {
281  u16_t snd_buf = pcbM->snd_buf;
282  if (0 == snd_buf)
283  break;
284 
285  if (datalen < snd_buf)
286  break;
287 
288  error = tcpLwipM->getLwipTcpLayer()->tcp_write(pcbM, ((const char *)data) + written, snd_buf, 1);
289 
290  if (error != ERR_OK)
291  break;
292 
293  written += snd_buf;
294  datalen -= snd_buf;
295  }
296  }
297 
298  if (written > 0) {
299  ASSERT(pcbM->snd_lbb - ss == (u32_t)written);
300  return written;
301  }
302 
303  return error;
304 }

Referenced by do_SEND().

◆ sendAvailableIndicationToApp()

void inet::tcp::TcpLwipConnection::sendAvailableIndicationToApp ( int  listenConnId)

Utility: sends TCP_I_AVAILABLE indication with TcpAvailableInfo to application.

98 {
99  EV_INFO << "Notifying app: " << indicationName(TCP_I_AVAILABLE) << "\n";
100  auto indication = new Indication(indicationName(TCP_I_AVAILABLE), TCP_I_AVAILABLE);
101  L3Address localAddr(pcbM->local_ip.addr), remoteAddr(pcbM->remote_ip.addr);
102 
103  TcpAvailableInfo *ind = new TcpAvailableInfo();
104  ind->setNewSocketId(connIdM);
105  ind->setLocalAddr(localAddr);
106  ind->setRemoteAddr(remoteAddr);
107  ind->setLocalPort(pcbM->local_port);
108  ind->setRemotePort(pcbM->remote_port);
109 
110  indication->setControlInfo(ind);
111  indication->addTag<TransportProtocolInd>()->setProtocol(&Protocol::tcp);
112  indication->addTag<SocketInd>()->setSocketId(listenConnId);
113  tcpLwipM->send(indication, "appOut");
114  // TODO shouldn't read from lwip until accept arrived
115 }

◆ sendEstablishedMsg()

void inet::tcp::TcpLwipConnection::sendEstablishedMsg ( )
118 {
119  auto indication = new Indication("TCP_I_ESTABLISHED", TCP_I_ESTABLISHED);
120  TcpConnectInfo *tcpConnectInfo = new TcpConnectInfo();
121 
122  L3Address localAddr(pcbM->local_ip.addr), remoteAddr(pcbM->remote_ip.addr);
123 
124  tcpConnectInfo->setLocalAddr(localAddr);
125  tcpConnectInfo->setRemoteAddr(remoteAddr);
126  tcpConnectInfo->setLocalPort(pcbM->local_port);
127  tcpConnectInfo->setRemotePort(pcbM->remote_port);
128 
129  indication->setControlInfo(tcpConnectInfo);
130  indication->addTag<TransportProtocolInd>()->setProtocol(&Protocol::udp);
131  indication->addTag<SocketInd>()->setSocketId(connIdM);
132 
133  tcpLwipM->send(indication, "appOut");
134  sendUpEnabled = true;
135  do_SEND();
136  // TODO now can read from lwip
137  sendUpData();
138 }

Referenced by accept(), and inet::tcp::TcpLwip::tcp_event_conn().

◆ sendIndicationToApp()

void inet::tcp::TcpLwipConnection::sendIndicationToApp ( int  code)
164 {
165  const char *nameOfIndication = indicationName(code);
166  EV_DETAIL << "Notifying app: " << nameOfIndication << "\n";
167  auto indication = new Indication(nameOfIndication, code);
168  TcpCommand *ind = new TcpCommand();
169  indication->setControlInfo(ind);
170  indication->addTag<TransportProtocolInd>()->setProtocol(&Protocol::tcp);
171  indication->addTag<SocketInd>()->setSocketId(connIdM);
172  tcpLwipM->send(indication, "appOut");
173 }

Referenced by inet::tcp::TcpLwip::tcp_event_err(), and inet::tcp::TcpLwip::tcp_event_recv().

◆ sendUpData()

void inet::tcp::TcpLwipConnection::sendUpData ( )
343 {
344  if (sendUpEnabled) {
345  while (Packet *dataMsg = receiveQueueM->extractBytesUpTo()) {
346  dataMsg->setKind(TCP_I_DATA);
347  dataMsg->addTag<TransportProtocolInd>()->setProtocol(&Protocol::tcp);
348  dataMsg->addTag<SocketInd>()->setSocketId(connIdM);
349 // int64_t len = dataMsg->getByteLength();
350  // send Msg to Application layer:
351  tcpLwipM->send(dataMsg, "appOut");
352 // while (len > 0) {
353 // unsigned int slen = len > 0xffff ? 0xffff : len;
354 // tcpLwipM->getLwipTcpLayer()->tcp_recved(pcbM, slen);
355 // len -= slen;
356 // }
357  }
358  }
359 }

Referenced by sendEstablishedMsg(), and inet::tcp::TcpLwip::tcp_event_recv().

Member Data Documentation

◆ connIdM

◆ isListenerM

bool inet::tcp::TcpLwipConnection::isListenerM = false
protected

Referenced by initConnection().

◆ onCloseM

bool inet::tcp::TcpLwipConnection::onCloseM = false
protected

◆ pcbM

◆ rcvAckSignal

simsignal_t inet::tcp::TcpLwipConnection::rcvAckSignal = registerSignal("rcvAck")
staticprotected

Referenced by recordReceive().

◆ rcvSeqSignal

simsignal_t inet::tcp::TcpLwipConnection::rcvSeqSignal = registerSignal("rcvSeq")
staticprotected

Referenced by recordReceive().

◆ rcvWndSignal

simsignal_t inet::tcp::TcpLwipConnection::rcvWndSignal = registerSignal("rcvWnd")
staticprotected

Referenced by recordReceive().

◆ receiveQueueM

◆ sendQueueM

TcpLwipSendQueue* inet::tcp::TcpLwipConnection::sendQueueM = nullptr

◆ sendUpEnabled

bool inet::tcp::TcpLwipConnection::sendUpEnabled = false
protected

◆ sndAckSignal

simsignal_t inet::tcp::TcpLwipConnection::sndAckSignal = registerSignal("sndAck")
staticprotected

Referenced by recordSend().

◆ sndNxtSignal

simsignal_t inet::tcp::TcpLwipConnection::sndNxtSignal = registerSignal("sndNxt")
staticprotected

Referenced by recordSend().

◆ sndWndSignal

simsignal_t inet::tcp::TcpLwipConnection::sndWndSignal = registerSignal("sndWnd")
staticprotected

Referenced by recordSend().

◆ tcpLwipM

◆ totalSentM

long int inet::tcp::TcpLwipConnection::totalSentM = 0
protected

The documentation for this class was generated from the following files:
inet::TCP_I_TIMED_OUT
@ TCP_I_TIMED_OUT
Definition: TcpCommand_m.h:133
inet::tcp::TcpLwipConnection::sndAckSignal
static simsignal_t sndAckSignal
Definition: TcpLwipConnection.h:94
inet::tcp::TcpLwipConnection::rcvWndSignal
static simsignal_t rcvWndSignal
Definition: TcpLwipConnection.h:96
inet::tcp::TcpLwipConnection::process_SEND
void process_SEND(Packet *msgP)
Definition: TcpLwipConnection.cc:448
inet::tcp::TcpLwipConnection::receiveQueueM
TcpLwipReceiveQueue * receiveQueueM
Definition: TcpLwipConnection.h:82
inet::tcp::TcpLwipConnection::recordSend
void recordSend(const TcpHeader &tcpsegP)
Definition: TcpLwipConnection.cc:34
inet::TCP_I_CLOSED
@ TCP_I_CLOSED
Definition: TcpCommand_m.h:130
inet::tcp::TcpLwipConnection::send
void send(Packet *msgP)
Definition: TcpLwipConnection.cc:251
TransportProtocolInd
removed DscpReq Ipv4ControlInfo Ipv6ControlInfo up L3AddressInd TransportProtocolInd
Definition: IUdp-gates.txt:20
inet::tcp::TcpLwipConnection::sendUpData
void sendUpData()
Definition: TcpLwipConnection.cc:342
ip_addr
Definition: ip_addr.h.txt:47
inet::tcp::TcpLwipConnection::process_ABORT
void process_ABORT(TcpCommand *tcpCommandP, cMessage *msgP)
Definition: TcpLwipConnection.cc:462
inet::Protocol::tcp
static const Protocol tcp
Definition: Protocol.h:112
inet::TCP_I_ESTABLISHED
@ TCP_I_ESTABLISHED
Definition: TcpCommand_m.h:128
inet::tcp::TcpLwipConnection::process_OPEN_ACTIVE
void process_OPEN_ACTIVE(TcpOpenCommand *tcpCommandP, cMessage *msgP)
Definition: TcpLwipConnection.cc:403
inet::tcp::TcpLwipSendQueue::getBytesForTcpLayer
virtual unsigned int getBytesForTcpLayer(void *bufferP, unsigned int bufferLengthP) const
Copy data to the buffer for send to LWIP.
Definition: TcpLwipQueues.cc:44
inet::tcp::TcpLwipConnection::rcvSeqSignal
static simsignal_t rcvSeqSignal
Definition: TcpLwipConnection.h:97
inet::tcp::memp_free
void memp_free(memp_t type, void *mem)
Put an element back into its pool.
Definition: memp.cc:356
inet::TCP_I_PEER_CLOSED
@ TCP_I_PEER_CLOSED
Definition: TcpCommand_m.h:129
inet::tcp::TcpLwipConnection::connIdM
int connIdM
Definition: TcpLwipConnection.h:79
inet::tcp::TcpLwipConnection::indicationName
static const char * indicationName(int code)
Definition: TcpLwipConnection.cc:140
inet::tcp::TcpLwipReceiveQueue::setConnection
virtual void setConnection(TcpLwipConnection *connP)
Add a connection queue.
Definition: TcpLwipQueues.cc:107
inet::TCP_I_AVAILABLE
@ TCP_I_AVAILABLE
Definition: TcpCommand_m.h:127
inet::tcp::TcpLwipConnection::onCloseM
bool onCloseM
Definition: TcpLwipConnection.h:88
inet::tcp::TcpLwipReceiveQueue::notifyAboutSending
virtual void notifyAboutSending(const TcpHeader *tcpsegP)
notify the queue about output messages
Definition: TcpLwipQueues.cc:163
inet::tcp::TcpLwipSendQueue::enqueueAppData
virtual void enqueueAppData(Packet *msgP)
Called on SEND app command, it inserts in the queue the data the user wants to send.
Definition: TcpLwipQueues.cc:37
inet::TCP_C_ACCEPT
@ TCP_C_ACCEPT
Definition: TcpCommand_m.h:84
inet::TCP_I_CONNECTION_RESET
@ TCP_I_CONNECTION_RESET
Definition: TcpCommand_m.h:132
inet::TCP_I_URGENT_DATA
@ TCP_I_URGENT_DATA
Definition: TcpCommand_m.h:126
inet::utils::createOne
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
inet::tcp::TcpLwipConnection::listen
void listen(const L3Address &localAddr, unsigned short localPort)
Definition: TcpLwipConnection.cc:201
inet::tcp::TcpLwipConnection::rcvAckSignal
static simsignal_t rcvAckSignal
Definition: TcpLwipConnection.h:98
inet::TCP_C_SEND
@ TCP_C_SEND
Definition: TcpCommand_m.h:85
inet::tcp::TcpLwipConnection::sndNxtSignal
static simsignal_t sndNxtSignal
Definition: TcpLwipConnection.h:93
CASE
#define CASE(x)
inet::tcp::TcpLwipConnection::isListenerM
bool isListenerM
Definition: TcpLwipConnection.h:87
ERR_MEM
#define ERR_MEM
Definition: err.h:57
inet::tcp::TcpLwip::getLwipTcpLayer
LwipTcpLayer * getLwipTcpLayer()
Definition: TcpLwip.h:93
inet::units::values::s
value< double, units::s > s
Definition: Units.h:1235
inet::TCP_C_STATUS
@ TCP_C_STATUS
Definition: TcpCommand_m.h:88
inet::Protocol::udp
static const Protocol udp
Definition: Protocol.h:117
inet::tcp::TcpLwipSendQueue::dequeueTcpLayerMsg
virtual void dequeueTcpLayerMsg(unsigned int msgLengthP)
This function should remove msgLengthP bytes from TCP layer queue.
Definition: TcpLwipQueues.cc:58
inet::TCP_C_OPEN_PASSIVE
@ TCP_C_OPEN_PASSIVE
Definition: TcpCommand_m.h:83
inet::tcp::TcpLwipConnection::accept
void accept()
Definition: TcpLwipConnection.cc:243
inet::tcp::TcpLwipConnection::do_SEND
void do_SEND()
Definition: TcpLwipConnection.cc:306
inet::tcp::TcpLwipConnection::close
void close()
Definition: TcpLwipConnection.cc:227
inet::tcp::TcpLwipConnection::sendEstablishedMsg
void sendEstablishedMsg()
Definition: TcpLwipConnection.cc:117
inet::tcp::TcpLwipSendQueue::setConnection
virtual void setConnection(TcpLwipConnection *connP)
set connection queue, and initialise queue variables.
Definition: TcpLwipQueues.cc:31
inet::tcp::TcpLwipConnection::tcpLwipM
TcpLwip * tcpLwipM
Definition: TcpLwipConnection.h:83
inet::tcp::TcpLwipConnection::fillStatusInfo
void fillStatusInfo(TcpStatusInfo &statusInfo)
Definition: TcpLwipConnection.cc:175
inet::TCP_C_CLOSE
@ TCP_C_CLOSE
Definition: TcpCommand_m.h:86
inet::tcp::u32_t
uint32_t u32_t
Definition: cc.h:38
inet::tcp::TcpLwipConnection::process_CLOSE
void process_CLOSE(TcpCommand *tcpCommandP, cMessage *msgP)
Definition: TcpLwipConnection.cc:454
inet::TCP_C_ABORT
@ TCP_C_ABORT
Definition: TcpCommand_m.h:87
inet::tcp::TcpLwipConnection::sendUpEnabled
bool sendUpEnabled
Definition: TcpLwipConnection.h:89
inet::tcp::TcpLwipConnection::abort
void abort()
Definition: TcpLwipConnection.cc:237
inet::tcp::TcpLwipConnection::send_data
int send_data(void *data, int len)
Definition: TcpLwipConnection.cc:262
inet::tcp::TcpLwipConnection::process_OPEN_PASSIVE
void process_OPEN_PASSIVE(TcpOpenCommand *tcpCommandP, cMessage *msgP)
Definition: TcpLwipConnection.cc:423
inet::tcp::TcpLwipConnection::pcbM
LwipTcpLayer::tcp_pcb * pcbM
Definition: TcpLwipConnection.h:80
inet::tcp::TcpLwipConnection::connect
void connect(const L3Address &localAddr, unsigned short localPort, const L3Address &remoteAddr, unsigned short remotePort)
Definition: TcpLwipConnection.cc:214
inet::tcp::TcpLwipConnection::sndWndSignal
static simsignal_t sndWndSignal
Definition: TcpLwipConnection.h:92
inet::tcp::u16_t
uint16_t u16_t
Definition: cc.h:34
inet::tcp::TcpLwipConnection::process_ACCEPT
void process_ACCEPT(TcpAcceptCommand *tcpCommand, cMessage *msg)
Definition: TcpLwipConnection.cc:441
inet::tcp::TcpLwipReceiveQueue::extractBytesUpTo
virtual Packet * extractBytesUpTo()
Should create a packet to be passed up to the app, up to (but NOT including) the given sequence no (u...
Definition: TcpLwipQueues.cc:132
inet::tcp::TcpLwipConnection::sendQueueM
TcpLwipSendQueue * sendQueueM
Definition: TcpLwipConnection.h:81
inet::TCP_I_STATUS
@ TCP_I_STATUS
Definition: TcpCommand_m.h:134
inet::TCP_I_DATA
@ TCP_I_DATA
Definition: TcpCommand_m.h:125
inet::tcp::TcpLwipConnection::totalSentM
long int totalSentM
Definition: TcpLwipConnection.h:86
inet::tcp::TcpLwipConnection::process_STATUS
void process_STATUS(TcpCommand *tcpCommandP, cMessage *msgP)
Definition: TcpLwipConnection.cc:470
ERR_OK
#define ERR_OK
Definition: err.h:56
inet::tcp::TcpLwipSendQueue::getBytesAvailable
virtual unsigned long getBytesAvailable() const
Utility function: returns how many bytes are available in the queue.
Definition: TcpLwipQueues.cc:63
inet::TCP_I_CONNECTION_REFUSED
@ TCP_I_CONNECTION_REFUSED
Definition: TcpCommand_m.h:131
inet::TCP_C_OPEN_ACTIVE
@ TCP_C_OPEN_ACTIVE
Definition: TcpCommand_m.h:82