234 if (msg->isSelfMessage())
237 switch (msg->getKind()) {
240 SCTPCommand *ind = check_and_cast<SCTPCommand *>(msg->getControlInfo()->dup());
241 cMessage *cmsg =
new cMessage(
"SCTP_C_ABORT");
242 SCTPSendInfo *cmd =
new SCTPSendInfo();
243 id = ind->getAssocId();
245 cmd->setSid(ind->getSid());
246 cmd->setNumMsgs(ind->getNumMsgs());
247 cmsg->setControlInfo(cmd);
259 SCTPConnectInfo *connectInfo = check_and_cast<SCTPConnectInfo *>(msg->removeControlInfo());
267 sprintf(text,
"App: Received Bytes of assoc %d",
serverAssocId);
270 sprintf(text,
"App: EndToEndDelay of assoc %d",
serverAssocId);
272 sprintf(text,
"Hist: EndToEndDelay of assoc %d",
serverAssocId);
278 if (par(
"numPacketsToSendPerClient").longValue() > 0) {
281 if (par(
"thinkTime").doubleValue() > 0) {
284 scheduleAt(simTime() + par(
"thinkTime"),
timeoutMsg);
304 cMessage *cmsg =
new cMessage(
"SCTP_C_QUEUE_MSGS_LIMIT");
305 SCTPInfo *qinfo =
new SCTPInfo();
308 qinfo->setAssocId(
id);
309 cmsg->setControlInfo(qinfo);
313 EV_INFO <<
"!!!!!!!!!!!!!!!All data sent from Server !!!!!!!!!!\n";
316 if (j->second == 0 && par(
"waitToClose").doubleValue() > 0) {
319 cMessage *abortMsg =
new cMessage(as);
321 scheduleAt(simTime() + par(
"waitToClose"), abortMsg);
324 EV_INFO <<
"no more packets to send, call shutdown for assoc " <<
serverAssocId <<
"\n";
325 cMessage *cmsg =
new cMessage(
"SCTP_C_SHUTDOWN");
326 SCTPCommand *cmd =
new SCTPCommand();
328 cmd->setAssocId(serverAssocId);
329 cmsg->setControlInfo(cmd);
340 SCTPCommand *ind = check_and_cast<SCTPCommand *>(msg->removeControlInfo());
341 cMessage *cmsg =
new cMessage(
"SCTP_C_RECEIVE");
342 SCTPSendInfo *cmd =
new SCTPSendInfo();
343 id = ind->getAssocId();
345 cmd->setSid(ind->getSid());
346 cmd->setNumMsgs(ind->getNumMsgs());
348 cmsg->setControlInfo(cmd);
351 if (!cmsg->isScheduled() &&
schedule ==
false) {
352 scheduleAt(simTime() + par(
"delayFirstRead"), cmsg);
360 SCTPCommand *ind = check_and_cast<SCTPCommand *>(msg->getControlInfo());
361 id = ind->getAssocId();
366 j->second +=
PK(msg)->getByteLength();
368 k->second->record(j->second);
372 if (par(
"numPacketsToReceivePerClient").longValue() > 0) {
375 SCTPSimpleMessage *smsg = check_and_cast<SCTPSimpleMessage *>(msg);
377 j->second->record(simTime() - smsg->getCreationTime());
379 k->second->collect(simTime() - smsg->getCreationTime());
381 if (i->second == 0) {
382 cMessage *cmsg =
new cMessage(
"SCTP_C_NO_OUTSTANDING");
383 SCTPInfo *qinfo =
new SCTPInfo();
385 qinfo->setAssocId(
id);
386 cmsg->setControlInfo(qinfo);
393 SCTPSendInfo *cmd =
new SCTPSendInfo();
396 SCTPSimpleMessage *smsg = check_and_cast<SCTPSimpleMessage *>(msg);
398 j->second->record(simTime() - smsg->getCreationTime());
400 k->second->collect(simTime() - smsg->getCreationTime());
401 cPacket *cmsg =
new cPacket(
"SCTP_C_SEND");
405 cmd->setSendUnordered(cmd->getSendUnordered());
409 cmsg->encapsulate(smsg);
411 cmsg->setControlInfo(cmd);
422 SCTPCommand *command = check_and_cast<SCTPCommand *>(msg->removeControlInfo());
423 id = command->getAssocId();
424 EV_INFO <<
"server: SCTP_I_SHUTDOWN_RECEIVED for assoc " <<
id <<
"\n";
430 if (i->second == 0) {
431 cMessage *cmsg =
new cMessage(
"SCTP_C_NO_OUTSTANDING");
432 SCTPInfo *qinfo =
new SCTPInfo();
434 qinfo->setAssocId(
id);
435 cmsg->setControlInfo(qinfo);
448 EV_INFO <<
"Streams have been resetted\n";
460 sprintf(buf,
"rcvd: %ld bytes\nsent: %ld bytes", l->second,
bytesSent);
461 getDisplayString().setTagArg(
"t", 0, buf);
cMessage * timeoutMsg
Definition: SCTPPeer.h:64
bool echo
Definition: SCTPPeer.h:53
Definition: SCTPCommand.h:80
Definition: SCTPCommand.h:67
int count(const std::vector< T > &v, const T &a)
Definition: stlutils.h:58
Definition: SCTPCommand.h:33
Definition: SCTPCommand.h:43
int serverAssocId
Definition: SCTPPeer.h:69
int packetsRcvd
Definition: SCTPPeer.h:85
void sendOrSchedule(cMessage *msg)
Definition: SCTPPeer.cc:149
Definition: SCTPCommand.h:79
Definition: SCTPSocket.h:87
Definition: SCTPCommand.h:63
static simsignal_t sentPkSignal
Definition: SCTPPeer.h:89
Definition: SCTPCommand.h:35
Definition: SCTPCommand.h:37
RcvdBytesPerAssoc rcvdBytesPerAssoc
Definition: SCTPPeer.h:77
bool schedule
Definition: SCTPPeer.h:55
int getState()
Returns the socket state, one of NOT_BOUND, CLOSED, LISTENING, CONNECTING, CONNECTED, etc.
Definition: SCTPSocket.h:154
Definition: SCTPCommand.h:65
Definition: SCTPCommand.h:42
void handleTimer(cMessage *msg)
Definition: SCTPPeer.cc:465
int queueSize
Definition: SCTPPeer.h:56
Definition: SCTPCommand.h:75
Definition: SCTPCommand.h:44
int numRequestsToSend
Definition: SCTPPeer.h:70
Definition: SCTPCommand.h:66
Definition: SCTPCommand.h:64
int lastStream
Definition: SCTPPeer.h:71
Definition: SCTPCommand.h:72
int outboundStreams
Definition: SCTPPeer.h:57
long bytesSent
Definition: SCTPPeer.h:81
#define PK(msg)
Definition: INETDefs.h:92
RcvdPacketsPerAssoc rcvdPacketsPerAssoc
Definition: SCTPPeer.h:75
bool shutdownReceived
Definition: SCTPPeer.h:67
void generateAndSend(SCTPConnectInfo *connectInfo)
Definition: SCTPPeer.cc:159
int packetsSent
Definition: SCTPPeer.h:83
SCTPSocket clientSocket
Definition: SCTPPeer.h:62
BytesPerAssoc bytesPerAssoc
Definition: SCTPPeer.h:78
const double k
Definition: QAM16Modulation.cc:24
int numSessions
Definition: SCTPPeer.h:87
HistEndToEndDelay histEndToEndDelay
Definition: SCTPPeer.h:79
void processMessage(cMessage *msg)
Examines the message (which should have arrived from SCTPMain), updates socket state, and if there is a callback object installed (see setCallbackObject(), class CallbackInterface), dispatches to the appropriate method of it with the same yourPtr that you gave in the setCallbackObject() call.
Definition: SCTPSocket.cc:479
SentPacketsPerAssoc sentPacketsPerAssoc
Definition: SCTPPeer.h:76
Definition: SCTPSocket.h:87
int notificationsReceived
Definition: SCTPPeer.h:86
EndToEndDelay endToEndDelay
Definition: SCTPPeer.h:80