INET Framework for OMNeT++/OMNEST
inet::NetPerfMeter Class Reference

Implementation of NetPerfMeter. More...

#include <NetPerfMeter.h>

Inheritance diagram for inet::NetPerfMeter:

Classes

class  ReceiverStatistics
 
class  SenderStatistics
 
struct  TraceEntry
 

Public Member Functions

 NetPerfMeter ()
 
 ~NetPerfMeter ()
 
virtual int numInitStages () const override
 
virtual void initialize (int stage) override
 
virtual void finish () override
 
virtual void handleMessage (cMessage *msg) override
 
virtual void refreshDisplay () const override
 
void establishConnection ()
 
void successfullyEstablishedConnection (cMessage *msg, const unsigned int queueSize)
 
void teardownConnection (const bool stopTimeReached=false)
 
void receiveMessage (cMessage *msg)
 
void resetStatistics ()
 
void writeStatistics ()
 
void sendSCTPQueueRequest (const unsigned int queueSize)
 
void sendTCPQueueRequest (const unsigned int queueSize)
 

Protected Types

enum  Protocol { SCTP = 0, TCP = 1, UDP = 2 }
 
enum  TimerType {
  TIMER_CONNECT = 1, TIMER_START = 2, TIMER_RESET = 3, TIMER_STOP = 4,
  TIMER_TRANSMIT = 5, TIMER_OFF = 6, TIMER_ON = 7
}
 

Protected Attributes

Protocol TransportProtocol = static_cast<Protocol>(-1)
 
bool ActiveMode = false
 
bool SendingAllowed = false
 
bool HasFinished = false
 
unsigned int MaxMsgSize = 0
 
unsigned int QueueSize = 0
 
double UnorderedMode = NAN
 
double UnreliableMode = NAN
 
bool DecoupleSaturatedStreams = false
 
simtime_t ConnectTime
 
simtime_t StartTime
 
simtime_t ResetTime
 
simtime_t StopTime
 
cMessage * ConnectTimer = nullptr
 
cMessage * StartTimer = nullptr
 
cMessage * StopTimer = nullptr
 
cMessage * ResetTimer = nullptr
 
cMessage * OffTimer = nullptr
 
cMessage * OnTimer = nullptr
 
unsigned int OnOffCycleCounter = 0
 
int MaxOnOffCycles = 0
 
std::vector< NetPerfMeterTransmitTimer * > TransmitTimerVector
 
unsigned int RequestedOutboundStreams = 0
 
unsigned int MaxInboundStreams = 0
 
unsigned int ActualOutboundStreams = 0
 
unsigned int ActualInboundStreams = 0
 
std::vector< cDynamicExpression > FrameRateExpressionVector
 
std::vector< cDynamicExpression > FrameSizeExpressionVector
 
SctpSocketSocketSCTP = nullptr
 
SctpSocketIncomingSocketSCTP = nullptr
 
TcpSocketSocketTCP = nullptr
 
TcpSocketIncomingSocketTCP = nullptr
 
UdpSocketSocketUDP = nullptr
 
int ConnectionID = 0
 
L3Address PrimaryPath
 
std::vector< TraceEntryTraceVector
 
size_t TraceIndex = 0
 
simtime_t TransmissionStartTime
 
simtime_t ConnectionEstablishmentTime
 
simtime_t StatisticsResetTime
 
unsigned int LastStreamID = 0
 
simtime_t StatisticsStartTime
 

Private Member Functions

SenderStatisticsgetSenderStatistics (const unsigned int streamID)
 
ReceiverStatisticsgetReceiverStatistics (const unsigned int streamID)
 
double getFrameRate (const unsigned int streamID)
 
unsigned long getFrameSize (const unsigned int streamID)
 
void startSending ()
 
void stopSending ()
 
void sendDataOfTraceFile (const unsigned long long bytesAvailableInQueue)
 
void sendDataOfSaturatedStreams (const unsigned long long bytesAvailableInQueue, const Ptr< const SctpSendQueueAbatedReq > &sendQueueAbatedIndication)
 
void sendDataOfNonSaturatedStreams (const unsigned long long bytesAvailableInQueue, const unsigned int streamID)
 
unsigned long transmitFrame (const unsigned int frameSize, const unsigned int streamID)
 
void createAndBindSocket ()
 
void handleTimer (cMessage *msg)
 

Static Private Member Functions

static opp_string format (const char *formatString,...)
 
static void parseExpressionVector (std::vector< cDynamicExpression > &expressionVector, const char *string, const char *delimiters=nullptr)
 

Private Attributes

std::map< unsigned int, SenderStatistics * > SenderStatisticsMap
 
std::map< unsigned int, ReceiverStatistics * > ReceiverStatisticsMap
 

Detailed Description

Implementation of NetPerfMeter.

See NED file for more details.

Member Enumeration Documentation

◆ Protocol

Enumerator
SCTP 
TCP 
UDP 
62  {
63  SCTP = 0, TCP = 1, UDP = 2
64  };

◆ TimerType

Enumerator
TIMER_CONNECT 
TIMER_START 
TIMER_RESET 
TIMER_STOP 
TIMER_TRANSMIT 
TIMER_OFF 
TIMER_ON 
65  {
66  TIMER_CONNECT = 1,
67  TIMER_START = 2,
68  TIMER_RESET = 3,
69  TIMER_STOP = 4,
70  TIMER_TRANSMIT = 5,
71  TIMER_OFF = 6,
72  TIMER_ON = 7
73  };

Constructor & Destructor Documentation

◆ NetPerfMeter()

inet::NetPerfMeter::NetPerfMeter ( )
70 {
71  SendingAllowed = false;
72  ConnectionID = 0;
74 }

◆ ~NetPerfMeter()

inet::NetPerfMeter::~NetPerfMeter ( )
78 {
79  cancelAndDelete(ConnectTimer);
80  ConnectTimer = nullptr;
81  cancelAndDelete(StartTimer);
82  StartTimer = nullptr;
83  cancelAndDelete(ResetTimer);
84  ResetTimer = nullptr;
85  cancelAndDelete(StopTimer);
86  StopTimer = nullptr;
87  for (auto& elem : TransmitTimerVector) {
88  cancelAndDelete(elem);
89  elem = nullptr;
90  }
91  if (SocketUDP != nullptr) {
92  delete SocketUDP;
93  SocketUDP = nullptr;
94  }
95  if (SocketTCP != nullptr) {
96  delete SocketTCP;
97  SocketTCP = nullptr;
98  }
99  if (IncomingSocketTCP != nullptr) {
100  delete IncomingSocketTCP;
101  IncomingSocketTCP = nullptr;
102  }
103  if (SocketSCTP != nullptr) {
104  delete SocketSCTP;
105  SocketSCTP = nullptr;
106  }
107  if (IncomingSocketSCTP != nullptr) {
108  delete IncomingSocketSCTP;
109  IncomingSocketSCTP = nullptr;
110  }
111 }

Member Function Documentation

◆ createAndBindSocket()

void inet::NetPerfMeter::createAndBindSocket ( )
private
696 {
697  const char *localAddress = par("localAddress");
698  const int localPort = par("localPort");
699  if ((ActiveMode == false) && (localPort == 0)) {
700  throw cRuntimeError("No local port number given in active mode!");
701  }
702  L3Address localAddr;
703  if (*localAddress)
704  localAddr = L3AddressResolver().resolve(localAddress);
705 
706  if (TransportProtocol == SCTP) {
707  assert(SocketSCTP == nullptr);
708  SocketSCTP = new SctpSocket;
711  SocketSCTP->setOutputGate(gate("socketOut"));
712  SocketSCTP->bind(localPort);
713  if (ActiveMode == false) {
714  SocketSCTP->listen(true);
715  }
716  }
717  else if (TransportProtocol == TCP) {
718  assert(SocketTCP == nullptr);
719  SocketTCP = new TcpSocket;
720  SocketTCP->setOutputGate(gate("socketOut"));
721  SocketTCP->bind(localAddr, localPort);
722  if (ActiveMode == false) {
723  SocketTCP->listen();
724  }
725  }
726  else if (TransportProtocol == UDP) {
727  assert(SocketUDP == nullptr);
728  SocketUDP = new UdpSocket;
729  SocketUDP->setOutputGate(gate("socketOut"));
730  SocketUDP->bind(localAddr, localPort);
731  }
732 }

Referenced by establishConnection(), and initialize().

◆ establishConnection()

void inet::NetPerfMeter::establishConnection ( )
541 {
542  const char *remoteAddress = par("remoteAddress");
543  const int remotePort = par("remotePort");
544 
545  // ====== Establish connection ===========================================
546  if (ActiveMode == true) {
548 
549  const char *primaryPath = par("primaryPath");
550  PrimaryPath = (primaryPath[0] != 0x00) ? L3AddressResolver().resolve(primaryPath) : L3Address();
551 
552  if (TransportProtocol == SCTP) {
553  AddressVector remoteAddressList;
554  remoteAddressList.push_back(L3AddressResolver().resolve(remoteAddress));
555  SocketSCTP->connectx(remoteAddressList, remotePort);
556  }
557  else if (TransportProtocol == TCP) {
559  SocketTCP->connect(L3AddressResolver().resolve(remoteAddress), remotePort);
560  }
561  else if (TransportProtocol == UDP) {
562  SocketUDP->connect(L3AddressResolver().resolve(remoteAddress), remotePort);
563  // Just start sending, since UDP is connection-less
565  }
566  ConnectionEstablishmentTime = simTime();
567  }
568  else {
569  // ------ Handle UDP on passive side ----------------
570  if (TransportProtocol == UDP) {
571 // SocketUDP->connect(L3AddressResolver().resolve(remoteAddress), remotePort);
573  }
574  }
575  EV << simTime() << ", " << getFullPath() << ": Sending allowed" << endl;
576  SendingAllowed = true;
577 }

Referenced by handleTimer().

◆ finish()

void inet::NetPerfMeter::finish ( )
overridevirtual
243 {
244  if (TransportProtocol == SCTP) {
245  }
246  else if (TransportProtocol == TCP) {
247  }
248  else if (TransportProtocol == UDP) {
249  }
250 
251  std::map<unsigned int, SenderStatistics *>::iterator senderStatisticsIterator = SenderStatisticsMap.begin();
252  while (senderStatisticsIterator != SenderStatisticsMap.end()) {
253  delete senderStatisticsIterator->second;
254  SenderStatisticsMap.erase(senderStatisticsIterator);
255  senderStatisticsIterator = SenderStatisticsMap.begin();
256  }
257  std::map<unsigned int, ReceiverStatistics *>::iterator receiverStatisticsIterator = ReceiverStatisticsMap.begin();
258  while (receiverStatisticsIterator != ReceiverStatisticsMap.end()) {
259  delete receiverStatisticsIterator->second;
260  ReceiverStatisticsMap.erase(receiverStatisticsIterator);
261  receiverStatisticsIterator = ReceiverStatisticsMap.begin();
262  }
263 }

◆ format()

opp_string inet::NetPerfMeter::format ( const char *  formatString,
  ... 
)
staticprivate
1231 {
1232  char str[1024];
1233  va_list args;
1234  va_start(args, formatString);
1235  vsnprintf(str, sizeof(str), formatString, args);
1236  va_end(args);
1237  return opp_string(str);
1238 }

Referenced by writeStatistics().

◆ getFrameRate()

double inet::NetPerfMeter::getFrameRate ( const unsigned int  streamID)
private
994 {
995  double frameRate;
996  if (FrameRateExpressionVector.size() == 0) {
997  frameRate = par("frameRate");
998  }
999  else {
1000  frameRate = FrameRateExpressionVector[streamID % FrameRateExpressionVector.size()].doubleValue(this, "Hz");
1001  if (frameRate < 0) {
1002  frameRate = par("frameRate");
1003  }
1004  }
1005  return frameRate;
1006 }

Referenced by sendDataOfNonSaturatedStreams(), and sendDataOfSaturatedStreams().

◆ getFrameSize()

unsigned long inet::NetPerfMeter::getFrameSize ( const unsigned int  streamID)
private
1010 {
1011  unsigned long frameSize;
1012  if (FrameSizeExpressionVector.size() == 0) {
1013  frameSize = par("frameSize");
1014  }
1015  else {
1016  double doubleSize = FrameSizeExpressionVector[streamID % FrameSizeExpressionVector.size()].doubleValue(this, "B");
1017  frameSize = (doubleSize >= 0.0) ? (long)doubleSize : par("frameSize");
1018  }
1019  return frameSize;
1020 }

Referenced by sendDataOfNonSaturatedStreams(), and sendDataOfSaturatedStreams().

◆ getReceiverStatistics()

ReceiverStatistics* inet::NetPerfMeter::getReceiverStatistics ( const unsigned int  streamID)
inlineprivate
172  {
173  auto found = ReceiverStatisticsMap.find(streamID);
174  assert(found != ReceiverStatisticsMap.end());
175  return found->second;
176  }

Referenced by receiveMessage().

◆ getSenderStatistics()

SenderStatistics* inet::NetPerfMeter::getSenderStatistics ( const unsigned int  streamID)
inlineprivate
166  {
167  auto found = SenderStatisticsMap.find(streamID);
168  assert(found != SenderStatisticsMap.end());
169  return found->second;
170  }

Referenced by transmitFrame().

◆ handleMessage()

void inet::NetPerfMeter::handleMessage ( cMessage *  msg)
overridevirtual
377 {
378  // ====== Timer handling =================================================
379  if (msg->isSelfMessage()) {
380  handleTimer(msg);
381  }
382  // ====== SCTP ===========================================================
383  else if (TransportProtocol == SCTP) {
384  switch (msg->getKind()) {
385  // ------ Data -----------------------------------------------------
386  case SCTP_I_DATA:
387  receiveMessage(msg);
388  break;
389  // ------ Data Arrival Indication ----------------------------------
391  // Data has arrived -> request it from the SCTP module.
392  auto& tags = check_and_cast<ITaggedObject *>(msg)->getTags();
393  auto dataIndication = tags.getTag<SctpCommandReq>();
394 // SctpInfoReq* command = new SctpInfoReq("SendCommand");
395  SctpInfoReq *command = new SctpInfoReq();
396  command->setSocketId(dataIndication->getSocketId());
397  command->setSid(dataIndication->getSid());
398  command->setNumMsgs(dataIndication->getNumMsgs());
399  Packet *cmsg = new Packet("ReceiveRequest", SCTP_C_RECEIVE);
400  auto cmd = cmsg->addTag<SctpSendReq>();
401  cmd->setSocketId(dataIndication->getSocketId());
402  cmd->setSid(dataIndication->getSid());
403  cmsg->addTag<SocketReq>()->setSocketId(dataIndication->getSocketId());
404  cmsg->addTag<DispatchProtocolReq>()->setProtocol(&inet::Protocol::sctp);
405  send(cmsg, "socketOut");
406  break;
407  }
408  // ------ Connection available -----------------------------------
409  case SCTP_I_AVAILABLE: {
410  EV_INFO << "SCTP_I_AVAILABLE arrived\n";
411  Message *message = check_and_cast<Message *>(msg);
412  int newSockId = message->getTag<SctpAvailableReq>()->getNewSocketId();
413  EV_INFO << "new socket id = " << newSockId << endl;
414  Request *cmsg = new Request("SCTP_C_ACCEPT_SOCKET_ID", SCTP_C_ACCEPT_SOCKET_ID);
415  cmsg->addTag<SctpAvailableReq>()->setSocketId(newSockId);
416  cmsg->addTag<DispatchProtocolReq>()->setProtocol(&inet::Protocol::sctp);
417  cmsg->addTag<SocketReq>()->setSocketId(newSockId);
418  EV_INFO << "Sending accept socket id request ..." << endl;
419  send(cmsg, "socketOut");
420  break;
421  }
422  // ------ Connection established -----------------------------------
423  case SCTP_I_ESTABLISHED: {
424  Message *message = check_and_cast<Message *>(msg);
425  auto& tags = message->getTags();
426  auto connectInfo = tags.getTag<SctpConnectReq>();
427  ActualOutboundStreams = connectInfo->getOutboundStreams();
430  }
431  ActualInboundStreams = connectInfo->getInboundStreams();
434  }
436  // NOTE: Start sending on stream 0!
438  break;
439  }
440  // ------ Queue indication -----------------------------------------
442  Message *message = check_and_cast<Message *>(msg);
443  auto& tags = message->getTags();
444  const auto& sendQueueAbatedIndication = tags.getTag<SctpSendQueueAbatedReq>();
445  assert(sendQueueAbatedIndication != nullptr);
446  // Queue is underfull again -> give it more data.
447  SendingAllowed = true;
448  if (TraceVector.size() == 0) {
449  sendDataOfSaturatedStreams(sendQueueAbatedIndication->getBytesAvailable(), sendQueueAbatedIndication);
450  }
451  break;
452  }
454  SendingAllowed = false;
455  break;
456  // ------ Errors ---------------------------------------------------
457  case SCTP_I_PEER_CLOSED:
458  case SCTP_I_CLOSED:
461  case SCTP_I_TIMED_OUT:
462  case SCTP_I_ABORT:
463  case SCTP_I_CONN_LOST:
466  break;
467  default:
468 // printf("SCTP: kind=%d\n", msg->getKind());
469  break;
470  }
471  }
472  // ====== TCP ============================================================
473  else if (TransportProtocol == TCP) {
474  short kind = msg->getKind();
475  switch (kind) {
476  // ------ Data -----------------------------------------------------
477  case TCP_I_DATA:
478  case TCP_I_URGENT_DATA:
479  receiveMessage(msg);
480  break;
481  // ------ Connection available -----------------------------------
482  case TCP_I_AVAILABLE: {
483  EV_INFO << "TCP_I_AVAILABLE arrived\n";
484  TcpAvailableInfo *availableInfo = check_and_cast<TcpAvailableInfo *>(msg->getControlInfo());
485  int newSockId = availableInfo->getNewSocketId();
486  EV_INFO << "new socket id = " << newSockId << endl;
487  Request *cmsg = new Request("TCP_C_ACCEPT", TCP_C_ACCEPT);
488  auto *acceptCmd = new TcpAcceptCommand();
489  cmsg->setControlInfo(acceptCmd);
490  cmsg->addTag<DispatchProtocolReq>()->setProtocol(&inet::Protocol::tcp);
491  cmsg->addTag<SocketReq>()->setSocketId(newSockId);
492  EV_INFO << "Sending accept socket id request ..." << endl;
493  send(cmsg, "socketOut");
494  break;
495  }
496  // ------ Connection established -----------------------------------
497  case TCP_I_ESTABLISHED:
499  break;
500  // ------ Queue indication -----------------------------------------
501  case TCP_I_SEND_MSG: {
502  const TcpCommand *tcpCommand = check_and_cast<TcpCommand *>(msg->getControlInfo());
503  // Queue is underfull again -> give it more data.
504  if (SocketTCP != nullptr) { // T.D. 16.11.2011: Ensure that there is still a TCP socket!
505  SendingAllowed = true;
506  if (TraceVector.size() == 0) {
507  sendDataOfSaturatedStreams(tcpCommand->getUserId(), nullptr);
508  }
509  }
510  }
511  break;
512  // ------ Errors ---------------------------------------------------
513  case TCP_I_PEER_CLOSED:
514  case TCP_I_CLOSED:
517  case TCP_I_TIMED_OUT:
519  break;
520  }
521  }
522  // ====== UDP ============================================================
523  else if (TransportProtocol == UDP) {
524  switch (msg->getKind()) {
525  // ------ Data -----------------------------------------------------
526  case UDP_I_DATA:
527  receiveMessage(msg);
528  break;
529  // ------ Error ----------------------------------------------------
530  case UDP_I_ERROR:
532  break;
533  }
534  }
535 
536  delete msg;
537 }

◆ handleTimer()

void inet::NetPerfMeter::handleTimer ( cMessage *  msg)
private
293 {
294  // ====== Transmit timer =================================================
295  const NetPerfMeterTransmitTimer *transmitTimer = dynamic_cast<NetPerfMeterTransmitTimer *>(msg);
296  if (transmitTimer) {
297  TransmitTimerVector[transmitTimer->getStreamID()] = nullptr;
298  if (TraceVector.size() > 0) {
300  }
301  else {
302  sendDataOfNonSaturatedStreams(QueueSize, transmitTimer->getStreamID());
303  }
304  }
305  // ====== Off timer ======================================================
306  else if (msg == OffTimer) {
307  EV << simTime() << ", " << getFullPath() << ": Entering OFF mode" << endl;
308  OffTimer = nullptr;
309  stopSending();
310  }
311  // ====== On timer =======================================================
312  else if (msg == OnTimer) {
313  EV << simTime() << ", " << getFullPath() << ": Entering ON mode" << endl;
314  OnTimer = nullptr;
315  startSending();
316  }
317  // ====== Reset timer ====================================================
318  else if (msg == ResetTimer) {
319  EV << simTime() << ", " << getFullPath() << ": Reset" << endl;
320 
321  ResetTimer = nullptr;
322  resetStatistics();
323 
324  assert(StopTimer == nullptr);
325  if (StopTime > 0.0) {
326  StopTimer = new cMessage("StopTimer", TIMER_STOP);
327  scheduleAfter(StopTime, StopTimer);
328  }
329  }
330  // ====== Stop timer =====================================================
331  else if (msg == StopTimer) {
332  EV << simTime() << ", " << getFullPath() << ": STOP" << endl;
333 
334  StopTimer = nullptr;
335  if (OffTimer) {
336  cancelAndDelete(OffTimer);
337  OffTimer = nullptr;
338  }
339  if (OnTimer) {
340  cancelAndDelete(OnTimer);
341  OnTimer = nullptr;
342  }
343 
344  if (TransportProtocol == SCTP) {
345  if (IncomingSocketSCTP != nullptr) {
347  }
348  else if (SocketSCTP != nullptr) {
349  SocketSCTP->close();
350  }
351  }
352  else if (TransportProtocol == TCP) {
353  if (SocketTCP != nullptr) {
354  SocketTCP->close();
355  }
356  }
357  teardownConnection(true);
358  }
359  // ====== Start timer ====================================================
360  else if (msg == StartTimer) {
361  EV << simTime() << ", " << getFullPath() << ": Start" << endl;
362 
363  StartTimer = nullptr;
364  startSending();
365  }
366  // ====== Connect timer ==================================================
367  else if (msg == ConnectTimer) {
368  EV << simTime() << ", " << getFullPath() << ": Connect" << endl;
369 
370  ConnectTimer = nullptr;
372  }
373 }

Referenced by handleMessage().

◆ initialize()

void inet::NetPerfMeter::initialize ( int  stage)
overridevirtual
130 {
131  if (stage == INITSTAGE_LOCAL) {
132  // ====== Handle parameters ==============================================
133  ActiveMode = par("activeMode");
134  const char *protocolPar = par("protocol");
135  if (strcmp(protocolPar, "TCP") == 0) {
137  }
138  else if (strcmp(protocolPar, "SCTP") == 0) {
140  }
141  else if (strcmp(protocolPar, "UDP") == 0) {
143  }
144  else {
145  throw cRuntimeError("Bad protocol setting!");
146  }
147 
149  MaxInboundStreams = 1;
152  LastStreamID = 1;
153  MaxMsgSize = par("maxMsgSize");
154  QueueSize = par("queueSize");
155  DecoupleSaturatedStreams = par("decoupleSaturatedStreams");
156  RequestedOutboundStreams = par("outboundStreams");
157  if ((RequestedOutboundStreams < 1) || (RequestedOutboundStreams > 65535)) {
158  throw cRuntimeError("Invalid number of outbound streams; use range from [1, 65535]");
159  }
160  MaxInboundStreams = par("maxInboundStreams");
161  if ((MaxInboundStreams < 1) || (MaxInboundStreams > 65535)) {
162  throw cRuntimeError("Invalid number of inbound streams; use range from [1, 65535]");
163  }
164  UnorderedMode = par("unordered");
165  if ((UnorderedMode < 0.0) || (UnorderedMode > 1.0)) {
166  throw cRuntimeError("Bad value for unordered probability; use range from [0.0, 1.0]");
167  }
168  UnreliableMode = par("unreliable");
169  if ((UnreliableMode < 0.0) || (UnreliableMode > 1.0)) {
170  throw cRuntimeError("Bad value for unreliable probability; use range from [0.0, 1.0]");
171  }
172  parseExpressionVector(FrameRateExpressionVector, par("frameRateString"), ";");
173  parseExpressionVector(FrameSizeExpressionVector, par("frameSizeString"), ";");
174 
175  TraceIndex = ~0;
176  if (strcmp(par("traceFile").stringValue(), "") != 0) {
177  std::fstream traceFile(par("traceFile").stringValue());
178  if (!traceFile.good()) {
179  throw cRuntimeError("Unable to load trace file");
180  }
181  while (!traceFile.eof()) {
182  TraceEntry traceEntry;
183  traceEntry.InterFrameDelay = 0;
184  traceEntry.FrameSize = 0;
185  traceEntry.StreamID = 0;
186 
187  char line[256];
188  traceFile.getline(line, sizeof(line), '\n');
189  if (sscanf(line, "%lf %u %u", &traceEntry.InterFrameDelay, &traceEntry.FrameSize, &traceEntry.StreamID) >= 2) {
190 // std::cout << "Frame: " << traceEntry.InterFrameDelay << "\t" << traceEntry.FrameSize << "\t" << traceEntry.StreamID << endl;
191  TraceVector.push_back(traceEntry);
192  }
193  }
194  }
195  }
196  else if (stage == INITSTAGE_APPLICATION_LAYER) {
197  // ====== Initialize and bind socket =====================================
198  SocketSCTP = IncomingSocketSCTP = nullptr;
199  SocketTCP = IncomingSocketTCP = nullptr;
200  SocketUDP = nullptr;
201 
202  for (unsigned int i = 0; i < RequestedOutboundStreams; i++) {
203  SenderStatistics *senderStatistics = new SenderStatistics;
204  SenderStatisticsMap.insert(std::pair<unsigned int, SenderStatistics *>(i, senderStatistics));
205  }
206  for (unsigned int i = 0; i < MaxInboundStreams; i++) {
207  ReceiverStatistics *receiverStatistics = new ReceiverStatistics;
208  ReceiverStatisticsMap.insert(std::pair<unsigned int, ReceiverStatistics *>(i, receiverStatistics));
209  }
210 
211  ConnectTime = par("connectTime");
212  StartTime = par("startTime");
213  ResetTime = par("resetTime");
214  StopTime = par("stopTime");
215  MaxOnOffCycles = par("maxOnOffCycles");
216 
217  HasFinished = false;
218  OffTimer = nullptr;
219  OnTimer = nullptr;
220  OnOffCycleCounter = 0;
221 
222  EV << simTime() << ", " << getFullPath() << ": Initialize"
223  << "\tConnectTime=" << ConnectTime
224  << "\tStartTime=" << StartTime
225  << "\tResetTime=" << ResetTime
226  << "\tStopTime=" << StopTime
227  << endl;
228 
229  if (ActiveMode == false) {
230  // Passive mode: create and bind socket immediately.
231  // For active mode, the socket will be created just before connect().
233  }
234 
235  // ====== Schedule Connect Timer =========================================
236  ConnectTimer = new cMessage("ConnectTimer", TIMER_CONNECT);
237  scheduleAt(ConnectTime, ConnectTimer);
238  }
239 }

◆ numInitStages()

virtual int inet::NetPerfMeter::numInitStages ( ) const
inlineoverridevirtual
43 { return NUM_INIT_STAGES; }

◆ parseExpressionVector()

void inet::NetPerfMeter::parseExpressionVector ( std::vector< cDynamicExpression > &  expressionVector,
const char *  string,
const char *  delimiters = nullptr 
)
staticprivate
117 {
118  expressionVector.clear();
119  cStringTokenizer tokenizer(string, delimiters);
120  while (tokenizer.hasMoreTokens()) {
121  const char *token = tokenizer.nextToken();
122  cDynamicExpression expression;
123  expression.parse(token);
124  expressionVector.push_back(expression);
125  }
126 }

Referenced by initialize().

◆ receiveMessage()

void inet::NetPerfMeter::receiveMessage ( cMessage *  msg)
1165 {
1166  if (const Packet *dataMessage = dynamic_cast<const Packet *>(msg)) {
1167  unsigned int streamID = 0;
1168  const auto& smsg = dataMessage->peekData();
1169 
1170  if (TransportProtocol == SCTP) {
1171  auto& tags = check_and_cast<ITaggedObject *>(msg)->getTags();
1172  auto& receiveCommand = tags.findTag<SctpRcvReq>();
1173  streamID = receiveCommand->getSid();
1174  }
1175 
1176  ReceiverStatistics *receiverStatistics = getReceiverStatistics(streamID);
1177  receiverStatistics->ReceivedMessages++;
1178  receiverStatistics->ReceivedBytes += B(smsg->getChunkLength()).get();
1179  for (auto& region : smsg->getAllTags<CreationTimeTag>())
1180  receiverStatistics->ReceivedDelayHistogram.collect(simTime() - region.getTag()->getCreationTime());
1181  }
1182 }

Referenced by handleMessage().

◆ refreshDisplay()

void inet::NetPerfMeter::refreshDisplay ( ) const
overridevirtual
267 {
268  unsigned long long totalSentBytes = 0;
269  for (std::map<unsigned int, SenderStatistics *>::const_iterator iterator = SenderStatisticsMap.begin();
270  iterator != SenderStatisticsMap.end(); iterator++)
271  {
272  const SenderStatistics *senderStatistics = iterator->second;
273  totalSentBytes += senderStatistics->SentBytes;
274  }
275 
276  unsigned long long totalReceivedBytes = 0;
277  for (std::map<unsigned int, ReceiverStatistics *>::const_iterator iterator = ReceiverStatisticsMap.begin();
278  iterator != ReceiverStatisticsMap.end(); iterator++)
279  {
280  const ReceiverStatistics *receiverStatistics = iterator->second;
281  totalReceivedBytes += receiverStatistics->ReceivedBytes;
282  }
283 
284  char status[64];
285  snprintf(status, sizeof(status), "In: %llu, Out: %llu",
286  totalReceivedBytes, totalSentBytes);
287  getDisplayString().setTagArg("t", 0, status);
288  // TODO also was setStatusString("Connecting"), setStatusString("Closed")
289 }

◆ resetStatistics()

void inet::NetPerfMeter::resetStatistics ( )
789 {
790  StatisticsStartTime = simTime();
791  for (auto& elem : SenderStatisticsMap) {
792  SenderStatistics *senderStatistics = elem.second;
793  senderStatistics->reset();
794  }
795  for (auto& elem : ReceiverStatisticsMap) {
796  ReceiverStatistics *receiverStatistics = elem.second;
797  receiverStatistics->reset();
798  }
799 }

Referenced by handleTimer(), NetPerfMeter(), and writeStatistics().

◆ sendDataOfNonSaturatedStreams()

void inet::NetPerfMeter::sendDataOfNonSaturatedStreams ( const unsigned long long  bytesAvailableInQueue,
const unsigned int  streamID 
)
private
1084 {
1085  assert(OnTimer == nullptr);
1086 
1087  // ====== Is there something to send? ====================================
1088  const double frameRate = getFrameRate(streamID);
1089  if (frameRate <= 0.0) {
1090  // No non-saturated transmission on this stream
1091  // => no need to re-schedule timer!
1092  return;
1093  }
1094 
1095  // ====== Is sending allowed (i.e. space in the queue)? ==================
1096  if (SendingAllowed) {
1097  const long frameSize = getFrameSize(streamID);
1098  if (frameSize < 1) {
1099  return;
1100  }
1101  if ((frameRate <= 0.0) && ((TransportProtocol == TCP) || (TransportProtocol == UDP))) {
1102  throw cRuntimeError("TCP and UDP do not support \"send as much as possible\" mode (frameRate=0)!");
1103  }
1104 
1105  // ====== Transmit frame ==============================================
1106  /*
1107  EV << simTime() << ", " << getFullPath() << ": Stream #" << streamID
1108  << ":\tframeRate=" << frameRate
1109  << "\tframeSize=" << frameSize << endl;
1110  */
1111  transmitFrame(frameSize, streamID);
1112  }
1113  else {
1114  // No transmission allowed -> skip this frame!
1115  }
1116 
1117  // ====== Schedule next frame transmission ===============================
1118  assert(TransmitTimerVector[streamID] == nullptr);
1119  TransmitTimerVector[streamID] = new NetPerfMeterTransmitTimer("TransmitTimer", TIMER_TRANSMIT);
1120  TransmitTimerVector[streamID]->setStreamID(streamID);
1121  const double nextFrameTime = 1.0 / frameRate;
1122  /*
1123  EV << simTime() << ", " << getFullPath()
1124  << ": Next on stream #" << streamID << " in " << nextFrameTime << "s" << endl;
1125  */
1126  scheduleAfter(nextFrameTime, TransmitTimerVector[streamID]);
1127 }

Referenced by handleTimer(), and startSending().

◆ sendDataOfSaturatedStreams()

void inet::NetPerfMeter::sendDataOfSaturatedStreams ( const unsigned long long  bytesAvailableInQueue,
const Ptr< const SctpSendQueueAbatedReq > &  sendQueueAbatedIndication 
)
private
1025 {
1026  if (OnTimer != nullptr) {
1027  // We are in Off mode -> nothing to send!
1028  return;
1029  }
1030 
1031  // ====== Is sending allowed (i.e. space in the queue)? ==================
1032  if (SendingAllowed) {
1033  // ====== SCTP tells current queue occupation for each stream =========
1034  unsigned long long contingent;
1035  unsigned long long queued[ActualOutboundStreams];
1036  if (sendQueueAbatedIndication == nullptr) {
1037  // At the moment, the actual queue size is unknown.
1038  // => Assume it to be bytesAvailableInQueue.
1039  contingent = bytesAvailableInQueue / ActualOutboundStreams;
1040  for (unsigned int streamID = 0; streamID < ActualOutboundStreams; streamID++) {
1041  queued[streamID] = 0;
1042  }
1043  }
1044  else {
1045  assert(ActualOutboundStreams <= sendQueueAbatedIndication->getQueuedForStreamArraySize());
1046  for (unsigned int streamID = 0; streamID < ActualOutboundStreams; streamID++) {
1047  queued[streamID] = sendQueueAbatedIndication->getQueuedForStream(streamID);
1048  }
1049  contingent = sendQueueAbatedIndication->getBytesLimit() / ActualOutboundStreams;
1050  }
1051 
1052  // ====== Send, but care for per-stream contingent ====================
1054  unsigned int startStreamID = LastStreamID;
1055  unsigned long long newlyQueuedBytes = 0;
1056  bool progress;
1057  do {
1058  // ====== Perform one round ========================================
1059  progress = false; // Will be set to true on any transmission progress
1060  // during the next round
1061  do {
1062  const double frameRate = getFrameRate(LastStreamID);
1063  if (frameRate < 0.0000001) { // Saturated stream
1064  if ((DecoupleSaturatedStreams == false) || (queued[LastStreamID] < contingent)) {
1065  // ====== Send one frame ==================================
1066  const unsigned long frameSize = getFrameSize(LastStreamID);
1067  if (frameSize >= 1) {
1068  const unsigned long long sent = transmitFrame(frameSize, LastStreamID);
1069  newlyQueuedBytes += sent;
1070  queued[LastStreamID] += sent;
1071  progress = true;
1072  }
1073  }
1074  }
1076  } while (LastStreamID != startStreamID);
1077  } while ((newlyQueuedBytes < bytesAvailableInQueue) && (progress == true));
1078  }
1079 }

Referenced by handleMessage(), and startSending().

◆ sendDataOfTraceFile()

void inet::NetPerfMeter::sendDataOfTraceFile ( const unsigned long long  bytesAvailableInQueue)
private
1131 {
1132  if (TraceIndex < TraceVector.size()) {
1133  const unsigned int frameSize = TraceVector[TraceIndex].FrameSize;
1134  unsigned int streamID = TraceVector[TraceIndex].StreamID;
1135  if (streamID >= ActualOutboundStreams) {
1136  if (TransportProtocol == SCTP) {
1137  throw cRuntimeError("Invalid streamID in trace");
1138  }
1139  streamID = 0;
1140  }
1141  transmitFrame(frameSize, streamID);
1142  TraceIndex++;
1143  }
1144 
1145  if (TraceIndex >= TraceVector.size()) {
1146  TraceIndex = 0;
1147  }
1148 
1149  // ====== Schedule next frame transmission ===============================
1150  if (TraceIndex < TraceVector.size()) {
1151  const double nextFrameTime = TraceVector[TraceIndex].InterFrameDelay;
1152  assert(TransmitTimerVector[0] == nullptr);
1153  TransmitTimerVector[0] = new NetPerfMeterTransmitTimer("TransmitTimer", TIMER_TRANSMIT);
1154  TransmitTimerVector[0]->setStreamID(0);
1155 
1156 // std::cout << simTime() << ", " << getFullPath()
1157 // << ": Next in " << nextFrameTime << "s" << endl;
1158 
1159  scheduleAfter(nextFrameTime, TransmitTimerVector[0]);
1160  }
1161 }

Referenced by handleTimer(), and startSending().

◆ sendSCTPQueueRequest()

void inet::NetPerfMeter::sendSCTPQueueRequest ( const unsigned int  queueSize)
1186 {
1187  assert(SocketSCTP != nullptr);
1188 
1189  // Tell SCTP to limit the send queue to the number of bytes specified.
1190  // When the queue is able accept more data again, it will be indicated by
1191  // SCTP_I_SENDQUEUE_ABATED!
1192 
1193  Request *cmsg = new Request("QueueRequest", SCTP_C_QUEUE_BYTES_LIMIT);
1194  auto queueInfo = cmsg->addTag<SctpInfoReq>();
1195  queueInfo->setText(queueSize);
1196  queueInfo->setSocketId(ConnectionID);
1197 
1198  if (IncomingSocketSCTP) {
1200  }
1201  else {
1202  SocketSCTP->sendRequest(cmsg);
1203  }
1204 }

Referenced by successfullyEstablishedConnection().

◆ sendTCPQueueRequest()

void inet::NetPerfMeter::sendTCPQueueRequest ( const unsigned int  queueSize)
1208 {
1209  assert(SocketTCP != nullptr);
1210 
1211  // Tell TCP to limit the send queue to the number of bytes specified.
1212  // When the queue is able accept more data again, it will be indicated by
1213  // TCP_I_SEND_MSG!
1214 
1215  TcpCommand *queueInfo = new TcpCommand();
1216  queueInfo->setUserId(queueSize);
1217 
1218  auto request = new Request("QueueRequest", TCP_C_QUEUE_BYTES_LIMIT);
1219  request->setControlInfo(queueInfo);
1220  request->addTag<SocketReq>()->setSocketId(ConnectionID);
1221  if (IncomingSocketTCP) {
1222  IncomingSocketTCP->sendCommand(request);
1223  }
1224  else {
1225  SocketTCP->sendCommand(request);
1226  }
1227 }

Referenced by successfullyEstablishedConnection().

◆ startSending()

void inet::NetPerfMeter::startSending ( )
private
655 {
656  if (TraceVector.size() > 0) {
658  }
659  else {
660  for (unsigned int streamID = 0; streamID < ActualOutboundStreams; streamID++) {
662  }
664  }
665 
666  // ------ On/Off handling ------------------------------------------------
667  const simtime_t onTime = par("onTime");
668  if (onTime.dbl() > 0.0) {
669  OffTimer = new cMessage("OffTimer", TIMER_OFF);
670  scheduleAfter(onTime, OffTimer);
671  }
672 }

Referenced by handleTimer().

◆ stopSending()

void inet::NetPerfMeter::stopSending ( )
private
676 {
677  // ------ Stop all transmission timers ----------------------------------
678  for (auto& elem : TransmitTimerVector) {
679  cancelAndDelete(elem);
680  elem = nullptr;
681  }
683 
684  // ------ Schedule On timer ----------------------------------------------
685  const simtime_t offDuration = par("offTime");
686  if ((offDuration.dbl() > 0.0)
687  && ((MaxOnOffCycles < 0) || (OnOffCycleCounter <= (unsigned int)MaxOnOffCycles)))
688  {
689  OnTimer = new cMessage("OnTimer", TIMER_ON);
690  scheduleAfter(offDuration, OnTimer);
691  }
692 }

Referenced by handleTimer().

◆ successfullyEstablishedConnection()

void inet::NetPerfMeter::successfullyEstablishedConnection ( cMessage *  msg,
const unsigned int  queueSize 
)
582 {
583  if (HasFinished) {
584  EV << "Already finished -> no new connection!" << endl;
585  SctpSocket newSocket(msg);
586  newSocket.abort();
587  return;
588  }
589 
590  // ====== Update queue size ==============================================
591  if (queueSize != 0) {
592  QueueSize = queueSize;
593  EV << simTime() << ", " << getFullPath() << ": Got queue size " << QueueSize << " from transport protocol" << endl;
594  }
595 
596  // ====== Get connection ID ==============================================
597  if (TransportProtocol == TCP) {
598  if (ActiveMode == false) {
599  assert(SocketTCP != nullptr);
600  if (IncomingSocketTCP != nullptr) {
601  delete IncomingSocketTCP;
602  }
603  IncomingSocketTCP = new TcpSocket(msg);
604  IncomingSocketTCP->setOutputGate(gate("socketOut"));
605  }
606 
607  ConnectionID = check_and_cast<Indication *>(msg)->getTag<SocketInd>()->getSocketId();
608  sendTCPQueueRequest(QueueSize); // Limit the send queue as given.
609  }
610  else if (TransportProtocol == SCTP) {
611  if (ActiveMode == false) {
612  assert(SocketSCTP != nullptr);
613  if (IncomingSocketSCTP != nullptr) {
614  delete IncomingSocketSCTP;
615  }
616  IncomingSocketSCTP = new SctpSocket(msg);
617  IncomingSocketSCTP->setOutputGate(gate("socketOut"));
618  }
619 
620  ConnectionID = check_and_cast<Indication *>(msg)->getTag<SocketInd>()->getSocketId();
621  sendSCTPQueueRequest(QueueSize); // Limit the send queue as given.
622  }
623 
624  // ====== Initialize TransmitTimerVector =================================
626  for (unsigned int i = 0; i < ActualOutboundStreams; i++) {
627  TransmitTimerVector[i] = nullptr;
628  }
629 
630  // ====== Schedule Start Timer to begin transmission =====================
631  if (OnOffCycleCounter == 0) {
632  assert(StartTimer == nullptr);
633  StartTimer = new cMessage("StartTimer", TIMER_START);
635  if (TransmissionStartTime < simTime()) {
636  throw cRuntimeError("Connection establishment has been too late. Check startTime parameter!");
637  }
638  scheduleAt(TransmissionStartTime, StartTimer);
639 
640  // ====== Schedule Reset Timer to reset statistics ====================
641  assert(ResetTimer == nullptr);
642  ResetTimer = new cMessage("ResetTimer", TIMER_RESET);
644  scheduleAt(StatisticsResetTime, ResetTimer);
645  }
646  else {
647  // ====== Restart transmission immediately ============================
648  StartTimer = new cMessage("StartTimer");
649  scheduleAfter(SIMTIME_ZERO, StartTimer);
650  }
651 }

Referenced by establishConnection(), and handleMessage().

◆ teardownConnection()

void inet::NetPerfMeter::teardownConnection ( const bool  stopTimeReached = false)
736 {
737  for (auto& elem : TransmitTimerVector) {
738  cancelAndDelete(elem);
739  elem = nullptr;
740  }
741 
742  if (ActiveMode == false) {
743  if (TransportProtocol == SCTP) {
744  if (IncomingSocketSCTP != nullptr) {
745  delete IncomingSocketSCTP;
746  IncomingSocketSCTP = nullptr;
747  }
748  }
749  else if (TransportProtocol == TCP) {
750  if (IncomingSocketTCP != nullptr) {
751  delete IncomingSocketTCP;
752  IncomingSocketTCP = nullptr;
753  }
754  }
755  }
756  if ((stopTimeReached) || (ActiveMode == true)) {
757  if (TransportProtocol == SCTP) {
758  if (SocketSCTP != nullptr) {
759  SocketSCTP->close();
760  delete SocketSCTP;
761  SocketSCTP = nullptr;
762  }
763  }
764  else if (TransportProtocol == TCP) {
765  if (SocketTCP != nullptr) {
766  SocketTCP->abort();
767  delete SocketTCP;
768  SocketTCP = nullptr;
769  }
770  }
771  else if (TransportProtocol == UDP) {
772  if (SocketUDP != nullptr) {
773  delete SocketUDP;
774  SocketUDP = nullptr;
775  }
776  }
777  SendingAllowed = false;
778  ConnectionID = 0;
779  }
780 
781  if (stopTimeReached) {
782  writeStatistics();
783  HasFinished = true;
784  }
785 }

Referenced by handleMessage(), and handleTimer().

◆ transmitFrame()

unsigned long inet::NetPerfMeter::transmitFrame ( const unsigned int  frameSize,
const unsigned int  streamID 
)
private
891 {
892  EV << simTime() << ", " << getFullPath() << ": Transmit frame of size "
893  << frameSize << " on stream #" << streamID << endl;
894  assert(OnTimer == nullptr);
895 
896  // ====== TCP ============================================================
897  unsigned long newlyQueuedBytes = 0;
898  if (TransportProtocol == TCP) {
899  // TCP is stream-oriented: just pass the amount of frame data.
900  auto cmsg = new Packet("NetPerfMeterDataMessage");
901  auto dataMessage = makeShared<BytesChunk>();
902  std::vector<uint8_t> vec;
903  vec.resize(frameSize);
904  for (uint32_t i = 0; i < frameSize; i++)
905  vec[i] = ((i & 1) ? 'D' : 'T');
906  dataMessage->setBytes(vec);
907  dataMessage->addTag<CreationTimeTag>()->setCreationTime(simTime());
908  cmsg->insertAtBack(dataMessage);
909 
910  if (IncomingSocketTCP) {
911  IncomingSocketTCP->send(cmsg);
912  }
913  else {
914  SocketTCP->send(cmsg);
915  }
916 
917  newlyQueuedBytes += frameSize;
918  SenderStatistics *senderStatistics = getSenderStatistics(0);
919  senderStatistics->SentBytes += frameSize;
920  senderStatistics->SentMessages++;
921  }
922  // ====== Message-Oriented Protocols =====================================
923  else {
924  unsigned int bytesToSend = frameSize;
925  do {
926  const unsigned int msgSize = (bytesToSend > MaxMsgSize) ? MaxMsgSize : bytesToSend;
927 
928  if (false) {
929  }
930  // ====== SCTP =====================================================
931 #ifdef INET_WITH_SCTP
932  else if (TransportProtocol == SCTP) {
933  const bool sendUnordered = (UnorderedMode > 0.0) ? (uniform(0.0, 1.0) < UnorderedMode) : false;
934  const bool sendUnreliable = (UnreliableMode > 0.0) ? (uniform(0.0, 1.0) < UnreliableMode) : false;
935 
936  auto cmsg = new Packet("NetPerfMeterDataMessage");
937  auto dataMessage = makeShared<BytesChunk>();
938  std::vector<uint8_t> vec;
939  vec.resize(msgSize);
940  for (uint32_t i = 0; i < msgSize; i++)
941  vec[i] = ((i & 1) ? 'D' : 'T');
942  dataMessage->setBytes(vec);
943  dataMessage->addTag<CreationTimeTag>()->setCreationTime(simTime());
944  cmsg->insertAtBack(dataMessage);
945 
946  cmsg->addTag<SocketReq>()->setSocketId(ConnectionID);
947  auto command = cmsg->addTag<SctpSendReq>();
948  command->setSocketId(ConnectionID);
949  command->setSid(streamID);
950  command->setSendUnordered((sendUnordered == true) ? COMPLETE_MESG_UNORDERED : COMPLETE_MESG_ORDERED);
951  command->setLast(true);
952  command->setPrimary(PrimaryPath.isUnspecified());
953  command->setRemoteAddr(PrimaryPath);
954  command->setPrValue(1);
955  command->setPrMethod((sendUnreliable == true) ? 2 : 0); // PR-SCTP policy: RTX
956 
957  cmsg->setKind(sendUnordered ? SCTP_C_SEND_ORDERED : SCTP_C_SEND_UNORDERED);
958  cmsg->addTag<DispatchProtocolReq>()->setProtocol(&inet::Protocol::sctp);
959  send(cmsg, "socketOut");
960 
961  SenderStatistics *senderStatistics = getSenderStatistics(streamID);
962  senderStatistics->SentBytes += msgSize;
963  senderStatistics->SentMessages++;
964  }
965 #endif
966  // ====== UDP ===================================================
967  else if (TransportProtocol == UDP) {
968  auto cmsg = new Packet("NetPerfMeterDataMessage");
969  auto dataMessage = makeShared<BytesChunk>();
970  std::vector<uint8_t> vec;
971  vec.resize(msgSize);
972  for (uint32_t i = 0; i < msgSize; i++)
973  vec[i] = ((i & 1) ? 'D' : 'T');
974  dataMessage->setBytes(vec);
975  dataMessage->addTag<CreationTimeTag>()->setCreationTime(simTime());
976  cmsg->insertAtBack(dataMessage);
977 
978  SocketUDP->send(cmsg);
979 
980  SenderStatistics *senderStatistics = getSenderStatistics(0);
981  senderStatistics->SentBytes += msgSize;
982  senderStatistics->SentMessages++;
983  }
984 
985  newlyQueuedBytes += msgSize;
986  bytesToSend -= msgSize;
987  } while (bytesToSend > 0);
988  }
989  return newlyQueuedBytes;
990 }

Referenced by sendDataOfNonSaturatedStreams(), sendDataOfSaturatedStreams(), and sendDataOfTraceFile().

◆ writeStatistics()

void inet::NetPerfMeter::writeStatistics ( )
803 {
804  const simtime_t statisticsStopTime = simTime();
805  const double duration = statisticsStopTime.dbl() - StatisticsStartTime.dbl();
806 
807  recordScalar("Total Measurement Duration", duration);
808  recordScalar("On-Off Cycles", OnOffCycleCounter);
809 
810  // ====== Per-Stream Statistics ==========================================
811  unsigned long long totalSentBytes = 0;
812  unsigned long long totalSentMessages = 0;
813  for (std::map<unsigned int, SenderStatistics *>::const_iterator iterator =
814  SenderStatisticsMap.begin(); iterator != SenderStatisticsMap.end();
815  iterator++)
816  {
817  const unsigned int streamID = iterator->first;
818  if (streamID >= ActualOutboundStreams) {
819  break;
820  }
821  const SenderStatistics *senderStatistics = iterator->second;
822  totalSentBytes += senderStatistics->SentBytes;
823  totalSentMessages += senderStatistics->SentMessages;
824 
825  const double transmissionBitRate = (duration > 0.0) ? (8 * senderStatistics->SentBytes / duration) : 0.0;
826  const double transmissionByteRate = (duration > 0.0) ? (senderStatistics->SentBytes / duration) : 0.0;
827  const double transmissionMessageRate = (duration > 0.0) ? (senderStatistics->SentMessages / duration) : 0.0;
828  recordScalar(format("Transmission Bit Rate Stream #%u", streamID).c_str(), transmissionBitRate);
829  recordScalar(format("Transmission Byte Rate Stream #%u", streamID).c_str(), transmissionByteRate);
830  recordScalar(format("Transmission Message Rate Stream #%u", streamID).c_str(), transmissionMessageRate);
831  recordScalar(format("Sent Bytes Stream #%u", streamID).c_str(), senderStatistics->SentBytes);
832  recordScalar(format("Sent Messages Stream #%u", streamID).c_str(), senderStatistics->SentMessages);
833  }
834 
835  unsigned long long totalReceivedBytes = 0;
836  unsigned long long totalReceivedMessages = 0;
837  for (auto& elem : ReceiverStatisticsMap) {
838  const unsigned int streamID = elem.first;
839  if (streamID >= ActualInboundStreams) {
840  break;
841  }
842  ReceiverStatistics *receiverStatistics = elem.second;
843  totalReceivedBytes += receiverStatistics->ReceivedBytes;
844  totalReceivedMessages += receiverStatistics->ReceivedMessages;
845 
846  // NOTE: When sending "as much as possible", the transmission counters are
847  // set to 0 on reset. If the queue is long enough, there may be no
848  // need to fill it again => counters will be 0 here.
849  const double receptionBitRate = (duration > 0.0) ? (8 * receiverStatistics->ReceivedBytes / duration) : 0.0;
850  const double receptionByteRate = (duration > 0.0) ? (receiverStatistics->ReceivedBytes / duration) : 0.0;
851  const double receptionMessageRate = (duration > 0.0) ? (receiverStatistics->ReceivedMessages / duration) : 0.0;
852  recordScalar(format("Reception Bit Rate Stream #%u", streamID).c_str(), receptionBitRate);
853  recordScalar(format("Reception Byte Rate Stream #%u", streamID).c_str(), receptionByteRate);
854  recordScalar(format("Reception Message Rate Stream #%u", streamID).c_str(), receptionMessageRate);
855  recordScalar(format("Received Bytes Stream #%u", streamID).c_str(), receiverStatistics->ReceivedBytes);
856  recordScalar(format("Received Messages Stream #%u", streamID).c_str(), receiverStatistics->ReceivedMessages);
857  receiverStatistics->ReceivedDelayHistogram.recordAs(format("Received Message Delay Stream #%u", streamID).c_str(), "s");
858  }
859 
860  // ====== Total Statistics ===============================================
861  // NOTE: When sending "as much as possible", the transmission counters are
862  // set to 0 on reset. If the queue is long enough, there may be no
863  // need to fill it again => counters will be 0 here.
864  const double totalReceptionBitRate = (duration > 0.0) ? (8 * totalReceivedBytes / duration) : 0.0;
865  const double totalReceptionByteRate = (duration > 0.0) ? (totalReceivedBytes / duration) : 0.0;
866  const double totalReceptionMessageRate = (duration > 0.0) ? (totalReceivedMessages / duration) : 0.0;
867  const double totalTransmissionBitRate = (duration > 0.0) ? (8 * totalSentBytes / duration) : 0.0;
868  const double totalTransmissionByteRate = (duration > 0.0) ? (totalSentBytes / duration) : 0.0;
869  const double totalTransmissionMessageRate = (duration > 0.0) ? (totalSentMessages / duration) : 0.0;
870 
871  // NOTE: The byte rate is redundant, but having bits and bytes
872  // makes manual reading of the results easier.
873  recordScalar("Total Transmission Bit Rate", totalTransmissionBitRate);
874  recordScalar("Total Transmission Byte Rate", totalTransmissionByteRate);
875  recordScalar("Total Transmission Message Rate", totalTransmissionMessageRate);
876  recordScalar("Total Sent Bytes", totalSentBytes);
877  recordScalar("Total Sent Messages", totalSentMessages);
878 
879  recordScalar("Total Reception Bit Rate", totalReceptionBitRate);
880  recordScalar("Total Reception Byte Rate", totalReceptionByteRate);
881  recordScalar("Total Reception Message Rate", totalReceptionMessageRate);
882  recordScalar("Total Received Bytes", totalReceivedBytes);
883  recordScalar("Total Received Messages", totalReceivedMessages);
884 
885  resetStatistics(); // Make sure that it is not mistakenly used later
886 }

Referenced by teardownConnection().

Member Data Documentation

◆ ActiveMode

bool inet::NetPerfMeter::ActiveMode = false
protected

◆ ActualInboundStreams

unsigned int inet::NetPerfMeter::ActualInboundStreams = 0
protected

◆ ActualOutboundStreams

unsigned int inet::NetPerfMeter::ActualOutboundStreams = 0
protected

◆ ConnectionEstablishmentTime

simtime_t inet::NetPerfMeter::ConnectionEstablishmentTime
protected

Referenced by establishConnection().

◆ ConnectionID

◆ ConnectTime

simtime_t inet::NetPerfMeter::ConnectTime
protected

◆ ConnectTimer

cMessage* inet::NetPerfMeter::ConnectTimer = nullptr
protected

◆ DecoupleSaturatedStreams

bool inet::NetPerfMeter::DecoupleSaturatedStreams = false
protected

◆ FrameRateExpressionVector

std::vector<cDynamicExpression> inet::NetPerfMeter::FrameRateExpressionVector
protected

Referenced by getFrameRate(), and initialize().

◆ FrameSizeExpressionVector

std::vector<cDynamicExpression> inet::NetPerfMeter::FrameSizeExpressionVector
protected

Referenced by getFrameSize(), and initialize().

◆ HasFinished

bool inet::NetPerfMeter::HasFinished = false
protected

◆ IncomingSocketSCTP

SctpSocket* inet::NetPerfMeter::IncomingSocketSCTP = nullptr
protected

◆ IncomingSocketTCP

TcpSocket* inet::NetPerfMeter::IncomingSocketTCP = nullptr
protected

◆ LastStreamID

unsigned int inet::NetPerfMeter::LastStreamID = 0
protected

◆ MaxInboundStreams

unsigned int inet::NetPerfMeter::MaxInboundStreams = 0
protected

◆ MaxMsgSize

unsigned int inet::NetPerfMeter::MaxMsgSize = 0
protected

Referenced by initialize(), and transmitFrame().

◆ MaxOnOffCycles

int inet::NetPerfMeter::MaxOnOffCycles = 0
protected

Referenced by initialize(), and stopSending().

◆ OffTimer

cMessage* inet::NetPerfMeter::OffTimer = nullptr
protected

◆ OnOffCycleCounter

unsigned int inet::NetPerfMeter::OnOffCycleCounter = 0
protected

◆ OnTimer

cMessage* inet::NetPerfMeter::OnTimer = nullptr
protected

◆ PrimaryPath

L3Address inet::NetPerfMeter::PrimaryPath
protected

◆ QueueSize

unsigned int inet::NetPerfMeter::QueueSize = 0
protected

◆ ReceiverStatisticsMap

std::map<unsigned int, ReceiverStatistics *> inet::NetPerfMeter::ReceiverStatisticsMap
private

◆ RequestedOutboundStreams

unsigned int inet::NetPerfMeter::RequestedOutboundStreams = 0
protected

◆ ResetTime

simtime_t inet::NetPerfMeter::ResetTime
protected

◆ ResetTimer

cMessage* inet::NetPerfMeter::ResetTimer = nullptr
protected

◆ SenderStatisticsMap

std::map<unsigned int, SenderStatistics *> inet::NetPerfMeter::SenderStatisticsMap
private

◆ SendingAllowed

bool inet::NetPerfMeter::SendingAllowed = false
protected

◆ SocketSCTP

◆ SocketTCP

◆ SocketUDP

UdpSocket* inet::NetPerfMeter::SocketUDP = nullptr
protected

◆ StartTime

simtime_t inet::NetPerfMeter::StartTime
protected

◆ StartTimer

cMessage* inet::NetPerfMeter::StartTimer = nullptr
protected

◆ StatisticsResetTime

simtime_t inet::NetPerfMeter::StatisticsResetTime
protected

◆ StatisticsStartTime

simtime_t inet::NetPerfMeter::StatisticsStartTime
protected

Referenced by resetStatistics(), and writeStatistics().

◆ StopTime

simtime_t inet::NetPerfMeter::StopTime
protected

Referenced by handleTimer(), and initialize().

◆ StopTimer

cMessage* inet::NetPerfMeter::StopTimer = nullptr
protected

Referenced by handleTimer(), and ~NetPerfMeter().

◆ TraceIndex

size_t inet::NetPerfMeter::TraceIndex = 0
protected

Referenced by initialize(), and sendDataOfTraceFile().

◆ TraceVector

std::vector<TraceEntry> inet::NetPerfMeter::TraceVector
protected

◆ TransmissionStartTime

simtime_t inet::NetPerfMeter::TransmissionStartTime
protected

◆ TransmitTimerVector

◆ TransportProtocol

◆ UnorderedMode

double inet::NetPerfMeter::UnorderedMode = NAN
protected

Referenced by initialize(), and transmitFrame().

◆ UnreliableMode

double inet::NetPerfMeter::UnreliableMode = NAN
protected

Referenced by initialize(), and transmitFrame().


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::UdpSocket::setOutputGate
void setOutputGate(cGate *toUdp)
Sets the gate on which to send to UDP.
Definition: UdpSocket.h:117
inet::NetPerfMeter::TIMER_ON
@ TIMER_ON
Definition: NetPerfMeter.h:72
inet::SCTP_C_SEND_UNORDERED
@ SCTP_C_SEND_UNORDERED
Definition: SctpCommand_m.h:138
inet::TCP_C_QUEUE_BYTES_LIMIT
@ TCP_C_QUEUE_BYTES_LIMIT
Definition: TcpCommand_m.h:89
inet::TcpSocket::send
virtual void send(Packet *msg) override
Sends data packet.
Definition: TcpSocket.cc:147
inet::AddressVector
std::vector< L3Address > AddressVector
Definition: SctpCommand_m.h:70
inet::NetPerfMeter::IncomingSocketTCP
TcpSocket * IncomingSocketTCP
Definition: NetPerfMeter.h:109
inet::SctpSocket::setOutputGate
void setOutputGate(cGate *toSctp)
Sets the gate on which to send to SCTP.
Definition: SctpSocket.h:174
inet::NetPerfMeter::TIMER_TRANSMIT
@ TIMER_TRANSMIT
Definition: NetPerfMeter.h:70
inet::UdpSocket::bind
void bind(int localPort)
Bind the socket to a local port number.
Definition: UdpSocket.cc:34
inet::TCP_I_CLOSED
@ TCP_I_CLOSED
Definition: TcpCommand_m.h:130
inet::NetPerfMeter::ResetTime
simtime_t ResetTime
Definition: NetPerfMeter.h:86
inet::NetPerfMeter::OnTimer
cMessage * OnTimer
Definition: NetPerfMeter.h:93
inet::NetPerfMeter::sendDataOfNonSaturatedStreams
void sendDataOfNonSaturatedStreams(const unsigned long long bytesAvailableInQueue, const unsigned int streamID)
Definition: NetPerfMeter.cc:1082
inet::SCTP_I_CLOSED
@ SCTP_I_CLOSED
Definition: SctpCommand_m.h:201
inet::NetPerfMeter::OnOffCycleCounter
unsigned int OnOffCycleCounter
Definition: NetPerfMeter.h:94
inet::NetPerfMeter::sendDataOfSaturatedStreams
void sendDataOfSaturatedStreams(const unsigned long long bytesAvailableInQueue, const Ptr< const SctpSendQueueAbatedReq > &sendQueueAbatedIndication)
Definition: NetPerfMeter.cc:1023
inet::NetPerfMeter::SenderStatisticsMap
std::map< unsigned int, SenderStatistics * > SenderStatisticsMap
Definition: NetPerfMeter.h:163
inet::NetPerfMeter::StatisticsResetTime
simtime_t StatisticsResetTime
Definition: NetPerfMeter.h:126
inet::SCTP_I_SENDQUEUE_FULL
@ SCTP_I_SENDQUEUE_FULL
Definition: SctpCommand_m.h:210
inet::NetPerfMeter::teardownConnection
void teardownConnection(const bool stopTimeReached=false)
Definition: NetPerfMeter.cc:735
inet::NetPerfMeter::createAndBindSocket
void createAndBindSocket()
Definition: NetPerfMeter.cc:695
inet::NetPerfMeter::QueueSize
unsigned int QueueSize
Definition: NetPerfMeter.h:80
inet::NetPerfMeter::ConnectionID
int ConnectionID
Definition: NetPerfMeter.h:111
inet::Protocol::tcp
static const Protocol tcp
Definition: Protocol.h:112
inet::TCP_I_ESTABLISHED
@ TCP_I_ESTABLISHED
Definition: TcpCommand_m.h:128
inet::NetPerfMeter::format
static opp_string format(const char *formatString,...)
Definition: NetPerfMeter.cc:1230
inet::NetPerfMeter::FrameRateExpressionVector
std::vector< cDynamicExpression > FrameRateExpressionVector
Definition: NetPerfMeter.h:102
inet::TCP_I_PEER_CLOSED
@ TCP_I_PEER_CLOSED
Definition: TcpCommand_m.h:129
inet::NetPerfMeter::SCTP
@ SCTP
Definition: NetPerfMeter.h:63
inet::SCTP_I_SENDQUEUE_ABATED
@ SCTP_I_SENDQUEUE_ABATED
Definition: SctpCommand_m.h:211
inet::NetPerfMeter::TIMER_START
@ TIMER_START
Definition: NetPerfMeter.h:67
inet::NetPerfMeter::TIMER_RESET
@ TIMER_RESET
Definition: NetPerfMeter.h:68
inet::NetPerfMeter::sendDataOfTraceFile
void sendDataOfTraceFile(const unsigned long long bytesAvailableInQueue)
Definition: NetPerfMeter.cc:1130
inet::SctpSocket::sendRequest
void sendRequest(cMessage *msg)
Send request.
Definition: SctpSocket.cc:389
inet::NetPerfMeter::ConnectTime
simtime_t ConnectTime
Definition: NetPerfMeter.h:84
inet::NetPerfMeter::FrameSizeExpressionVector
std::vector< cDynamicExpression > FrameSizeExpressionVector
Definition: NetPerfMeter.h:103
inet::TCP_I_AVAILABLE
@ TCP_I_AVAILABLE
Definition: TcpCommand_m.h:127
DispatchProtocolReq
removed DscpReq Ipv4ControlInfo Ipv6ControlInfo up L3AddressInd DispatchProtocolReq L4PortInd Ipv4ControlInfo Ipv6ControlInfo down DispatchProtocolReq
Definition: IUdp-gates.txt:25
inet::TcpSocket::sendCommand
void sendCommand(Request *msg)
Sends command.
Definition: TcpSocket.cc:156
inet::TcpSocket::connect
void connect(L3Address remoteAddr, int remotePort)
Active OPEN to the given remote socket.
Definition: TcpSocket.cc:122
inet::NetPerfMeter::handleTimer
void handleTimer(cMessage *msg)
Definition: NetPerfMeter.cc:292
inet::NetPerfMeter::getFrameRate
double getFrameRate(const unsigned int streamID)
Definition: NetPerfMeter.cc:993
inet::SCTP_I_CONN_LOST
@ SCTP_I_CONN_LOST
Definition: SctpCommand_m.h:207
inet::TCP_C_ACCEPT
@ TCP_C_ACCEPT
Definition: TcpCommand_m.h:84
inet::NetPerfMeter::sendTCPQueueRequest
void sendTCPQueueRequest(const unsigned int queueSize)
Definition: NetPerfMeter.cc:1207
inet::SCTP_I_CONNECTION_REFUSED
@ SCTP_I_CONNECTION_REFUSED
Definition: SctpCommand_m.h:202
inet::NetPerfMeter::StatisticsStartTime
simtime_t StatisticsStartTime
Definition: NetPerfMeter.h:132
inet::SCTP_C_ACCEPT_SOCKET_ID
@ SCTP_C_ACCEPT_SOCKET_ID
Definition: SctpCommand_m.h:153
inet::TCP_I_CONNECTION_RESET
@ TCP_I_CONNECTION_RESET
Definition: TcpCommand_m.h:132
inet::NetPerfMeter::SocketSCTP
SctpSocket * SocketSCTP
Definition: NetPerfMeter.h:106
inet::TCP_I_URGENT_DATA
@ TCP_I_URGENT_DATA
Definition: TcpCommand_m.h:126
inet::NetPerfMeter::ActiveMode
bool ActiveMode
Definition: NetPerfMeter.h:76
inet::L3Address::isUnspecified
bool isUnspecified() const
Definition: L3Address.cc:138
inet::SCTP_C_RECEIVE
@ SCTP_C_RECEIVE
Definition: SctpCommand_m.h:136
inet::SCTP_I_DATA
@ SCTP_I_DATA
Definition: SctpCommand_m.h:197
inet::NetPerfMeter::IncomingSocketSCTP
SctpSocket * IncomingSocketSCTP
Definition: NetPerfMeter.h:107
inet::UdpSocket::send
virtual void send(Packet *msg) override
Sends a data packet to the address and port specified previously in a connect() call.
Definition: UdpSocket.cc:80
inet::NetPerfMeter::getReceiverStatistics
ReceiverStatistics * getReceiverStatistics(const unsigned int streamID)
Definition: NetPerfMeter.h:172
inet::SctpSocket::close
void close(int id)
Closes the local end of the connection.
Definition: SctpSocket.cc:394
inet::NetPerfMeter::writeStatistics
void writeStatistics()
Definition: NetPerfMeter.cc:802
inet::NetPerfMeter::parseExpressionVector
static void parseExpressionVector(std::vector< cDynamicExpression > &expressionVector, const char *string, const char *delimiters=nullptr)
Definition: NetPerfMeter.cc:114
inet::SCTP_I_ESTABLISHED
@ SCTP_I_ESTABLISHED
Definition: SctpCommand_m.h:199
inet::NetPerfMeter::getFrameSize
unsigned long getFrameSize(const unsigned int streamID)
Definition: NetPerfMeter.cc:1009
inet::UdpSocket::connect
void connect(L3Address remoteAddr, int remotePort)
Connects to a remote UDP socket.
Definition: UdpSocket.cc:53
inet::NetPerfMeter::SendingAllowed
bool SendingAllowed
Definition: NetPerfMeter.h:77
inet::units::units::B
intscale< b, 1, 8 > B
Definition: Units.h:1168
inet::SctpSocket::listen
void listen(bool fork=true, bool streamReset=false, uint32_t requests=0, uint32_t messagesToPush=0)
Initiates passive OPEN.
Definition: SctpSocket.cc:183
inet::SCTP_C_SEND_ORDERED
@ SCTP_C_SEND_ORDERED
Definition: SctpCommand_m.h:137
inet::NetPerfMeter::MaxInboundStreams
unsigned int MaxInboundStreams
Definition: NetPerfMeter.h:99
inet::NetPerfMeter::LastStreamID
unsigned int LastStreamID
Definition: NetPerfMeter.h:129
inet::SctpSocket::setOutboundStreams
void setOutboundStreams(int streams)
Setter and getter methods for socket and API Parameters.
Definition: SctpSocket.h:179
inet::SCTP_I_CONNECTION_RESET
@ SCTP_I_CONNECTION_RESET
Definition: SctpCommand_m.h:203
inet::NetPerfMeter::ConnectTimer
cMessage * ConnectTimer
Definition: NetPerfMeter.h:88
inet::NetPerfMeter::UDP
@ UDP
Definition: NetPerfMeter.h:63
inet::SCTP_C_QUEUE_BYTES_LIMIT
@ SCTP_C_QUEUE_BYTES_LIMIT
Definition: SctpCommand_m.h:140
inet::SCTP_I_SHUTDOWN_RECEIVED
@ SCTP_I_SHUTDOWN_RECEIVED
Definition: SctpCommand_m.h:209
inet::NetPerfMeter::HasFinished
bool HasFinished
Definition: NetPerfMeter.h:78
inet::SCTP_I_PEER_CLOSED
@ SCTP_I_PEER_CLOSED
Definition: SctpCommand_m.h:200
inet::NetPerfMeter::TraceVector
std::vector< TraceEntry > TraceVector
Definition: NetPerfMeter.h:120
inet::NetPerfMeter::TIMER_STOP
@ TIMER_STOP
Definition: NetPerfMeter.h:69
inet::TcpSocket::listen
void listen(bool fork)
Definition: TcpSocket.cc:95
inet::NetPerfMeter::TIMER_CONNECT
@ TIMER_CONNECT
Definition: NetPerfMeter.h:66
inet::NetPerfMeter::MaxOnOffCycles
int MaxOnOffCycles
Definition: NetPerfMeter.h:95
inet::INITSTAGE_LOCAL
INET_API InitStage INITSTAGE_LOCAL
Initialization of local state that don't use or affect other modules includes:
inet::NetPerfMeter::UnreliableMode
double UnreliableMode
Definition: NetPerfMeter.h:82
kind
removed DscpReq kind
Definition: IUdp-gates.txt:12
inet::NetPerfMeter::getSenderStatistics
SenderStatistics * getSenderStatistics(const unsigned int streamID)
Definition: NetPerfMeter.h:166
inet::NetPerfMeter::PrimaryPath
L3Address PrimaryPath
Definition: NetPerfMeter.h:112
inet::NetPerfMeter::StartTimer
cMessage * StartTimer
Definition: NetPerfMeter.h:89
inet::NetPerfMeter::ReceiverStatisticsMap
std::map< unsigned int, ReceiverStatistics * > ReceiverStatisticsMap
Definition: NetPerfMeter.h:164
NUM_INIT_STAGES
#define NUM_INIT_STAGES
Definition: InitStageRegistry.h:73
inet::SCTP_I_DATA_NOTIFICATION
@ SCTP_I_DATA_NOTIFICATION
Definition: SctpCommand_m.h:198
inet::NetPerfMeter::ActualOutboundStreams
unsigned int ActualOutboundStreams
Definition: NetPerfMeter.h:100
inet::NetPerfMeter::TraceIndex
size_t TraceIndex
Definition: NetPerfMeter.h:121
inet::NetPerfMeter::ConnectionEstablishmentTime
simtime_t ConnectionEstablishmentTime
Definition: NetPerfMeter.h:125
inet::SCTP_I_TIMED_OUT
@ SCTP_I_TIMED_OUT
Definition: SctpCommand_m.h:204
inet::NetPerfMeter::MaxMsgSize
unsigned int MaxMsgSize
Definition: NetPerfMeter.h:79
inet::NetPerfMeter::receiveMessage
void receiveMessage(cMessage *msg)
Definition: NetPerfMeter.cc:1164
inet::NetPerfMeter::stopSending
void stopSending()
Definition: NetPerfMeter.cc:675
inet::NetPerfMeter::StartTime
simtime_t StartTime
Definition: NetPerfMeter.h:85
inet::NetPerfMeter::TransmissionStartTime
simtime_t TransmissionStartTime
Definition: NetPerfMeter.h:124
inet::INITSTAGE_APPLICATION_LAYER
INET_API InitStage INITSTAGE_APPLICATION_LAYER
Initialization of applications.
inet::SctpSocket::connectx
void connectx(AddressVector remoteAddresses, int32_t remotePort, bool streamReset=false, int32_t prMethod=0, uint32_t numRequests=0)
Active OPEN to the given remote socket.
Definition: SctpSocket.cc:348
inet::COMPLETE_MESG_ORDERED
@ COMPLETE_MESG_ORDERED
Definition: SctpCommand_m.h:236
inet::UDP_I_DATA
@ UDP_I_DATA
Definition: UdpControlInfo_m.h:157
inet::SCTP_I_ABORT
@ SCTP_I_ABORT
Definition: SctpCommand_m.h:206
inet::Protocol::sctp
static const Protocol sctp
Definition: Protocol.h:108
inet::NetPerfMeter::sendSCTPQueueRequest
void sendSCTPQueueRequest(const unsigned int queueSize)
Definition: NetPerfMeter.cc:1185
inet::NetPerfMeter::transmitFrame
unsigned long transmitFrame(const unsigned int frameSize, const unsigned int streamID)
Definition: NetPerfMeter.cc:889
inet::NetPerfMeter::establishConnection
void establishConnection()
Definition: NetPerfMeter.cc:540
inet::COMPLETE_MESG_UNORDERED
@ COMPLETE_MESG_UNORDERED
Definition: SctpCommand_m.h:235
tags
* tags
Definition: IUdp-gates.txt:3
inet::NetPerfMeter::DecoupleSaturatedStreams
bool DecoupleSaturatedStreams
Definition: NetPerfMeter.h:83
inet::NetPerfMeter::StopTime
simtime_t StopTime
Definition: NetPerfMeter.h:87
inet::NetPerfMeter::TCP
@ TCP
Definition: NetPerfMeter.h:63
inet::NetPerfMeter::ResetTimer
cMessage * ResetTimer
Definition: NetPerfMeter.h:91
inet::NetPerfMeter::startSending
void startSending()
Definition: NetPerfMeter.cc:654
inet::NetPerfMeter::RequestedOutboundStreams
unsigned int RequestedOutboundStreams
Definition: NetPerfMeter.h:98
inet::NetPerfMeter::TransmitTimerVector
std::vector< NetPerfMeterTransmitTimer * > TransmitTimerVector
Definition: NetPerfMeter.h:96
inet::TcpSocket::abort
void abort()
Aborts the connection.
Definition: TcpSocket.cc:175
inet::NetPerfMeter::StopTimer
cMessage * StopTimer
Definition: NetPerfMeter.h:90
inet::TcpSocket::bind
void bind(int localPort)
Bind the socket to a local port number.
Definition: TcpSocket.cc:69
inet::NetPerfMeter::SocketTCP
TcpSocket * SocketTCP
Definition: NetPerfMeter.h:108
inet::TcpSocket::setOutputGate
void setOutputGate(cGate *toTcp)
Sets the gate on which to send to TCP.
Definition: TcpSocket.h:242
inet::TCP_I_DATA
@ TCP_I_DATA
Definition: TcpCommand_m.h:125
inet::TcpSocket::close
void close() override
Closes the local end of the connection.
Definition: TcpSocket.cc:161
inet::NetPerfMeter::resetStatistics
void resetStatistics()
Definition: NetPerfMeter.cc:788
inet::NetPerfMeter::TIMER_OFF
@ TIMER_OFF
Definition: NetPerfMeter.h:71
inet::SctpSocket::bind
void bind(int localPort)
Bind the socket to a local port number.
Definition: SctpSocket.cc:142
inet::NetPerfMeter::successfullyEstablishedConnection
void successfullyEstablishedConnection(cMessage *msg, const unsigned int queueSize)
Definition: NetPerfMeter.cc:580
inet::UDP_I_ERROR
@ UDP_I_ERROR
Definition: UdpControlInfo_m.h:158
inet::NetPerfMeter::ActualInboundStreams
unsigned int ActualInboundStreams
Definition: NetPerfMeter.h:101
inet::TCP_I_SEND_MSG
@ TCP_I_SEND_MSG
Definition: TcpCommand_m.h:135
inet::TcpSocket::renewSocket
void renewSocket()
Required to re-connect with a "used" TcpSocket object.
Definition: TcpSocket.cc:249
inet::SctpSocket::setInboundStreams
void setInboundStreams(int streams)
Definition: SctpSocket.h:180
inet::SCTP_I_AVAILABLE
@ SCTP_I_AVAILABLE
Definition: SctpCommand_m.h:218
inet::NetPerfMeter::OffTimer
cMessage * OffTimer
Definition: NetPerfMeter.h:92
inet::NetPerfMeter::SocketUDP
UdpSocket * SocketUDP
Definition: NetPerfMeter.h:110
inet::NetPerfMeter::TransportProtocol
Protocol TransportProtocol
Definition: NetPerfMeter.h:75
inet::NetPerfMeter::UnorderedMode
double UnorderedMode
Definition: NetPerfMeter.h:81
inet::TCP_I_CONNECTION_REFUSED
@ TCP_I_CONNECTION_REFUSED
Definition: TcpCommand_m.h:131