12     unsigned int Flow::cepID = 1;
 
   25         srcAddr(
Address(SRC.c_str(), DIF.c_str())),
 
   26         dstAddr(
Address(DST.c_str(), DIF.c_str())),
 
   28         minS(avgPDU - varPDU),
 
   29         maxS(avgPDU + varPDU),
 
   33         fcepID(
Flow::cepID++),
 
   43         int size = intuniform(NULL,
minS, 
maxS);
 
   46         ret.
wT = 8*(size+11) * 
avgWT * exponential(NULL,1);
 
   74         pdu->setByteLength(size);
 
   92     void Infection::initialize() {
 
   93         double iniT = par(
"iniTime").doubleValue();
 
   95         if(iniT<0 || par(
"infectedIPC").stdstringValue() == 
"") { 
return; }
 
   97         finTime = par(
"finTime").doubleValue();
 
   99         emitSignals = par(
"signal").boolValue();
 
  100         if(emitSignals) { signal = registerSignal(
"InfectionSignal"); }
 
  102         markIniT = par(
"markIniT").doubleValue();
 
  103         markFinT = par(
"markFinT").doubleValue();
 
  105         mod = this->getParentModule()->getSubmodule(par(
"infectedIPC").stringValue());
 
  106         if(mod==NULL) { 
return; }
 
  108         rmt = mod->getSubmodule(
"relayAndMux")->getSubmodule(
"rmt");
 
  110         rmt->addGate(
"infGate", cGate::INOUT, 
false);
 
  111         cGate * modIn = rmt->gateHalf(
"infGate", cGate::INPUT);
 
  112         cGate * modOut = rmt->gateHalf(
"infGate", cGate::OUTPUT);
 
  114         cGate * In = gateHalf(
"g", cGate::INPUT);
 
  115         cGate * Out = gateHalf(
"g", cGate::OUTPUT);
 
  117         modOut->connectTo(In);
 
  118         Out->connectTo(modIn);
 
  120         string DIF = mod->par(
"difName");
 
  121         string SRC = mod->par(
"ipcAddress");
 
  123         cXMLElement* Xml = NULL;
 
  124         if (par(
"data").xmlValue() != NULL && par(
"data").xmlValue()->hasChildren()){
 
  125             Xml = par(
"data").xmlValue();
 
  126         } 
else { error(
"data parameter not initialized!"); }
 
  128         double linkRate = par(
"linkRate").doubleValue();
 
  129         double usage = par(
"usage").doubleValue();
 
  132         double unitRate = linkRate * usage;
 
  134         cXMLElementList flowsXML = Xml->getChildrenByTagName(
"flow");
 
  135         for(cXMLElement * n : flowsXML) {
 
  139             DST = n->getAttribute(
"dstAddr");
 
  141                 error(
"Error parsing Infected flow. Its dstAddr is missing!"); }
 
  142             if(DST == SRC) { 
continue; }
 
  144             if (n->getAttribute(
"qos")) { QoS = n->getAttribute(
"qos"); }
 
  146             int N = 1, rec = 1, pduS = 1024, pduSv = 0;
 
  149             if (n->getAttribute(
"N") && atoi(n->getAttribute(
"N")) > 0) {
 
  150                 N = atoi(n->getAttribute(
"N")); }
 
  151             if (n->getAttribute(
"rec") && atoi(n->getAttribute(
"rec")) > 0) {
 
  152                 rec = atoi(n->getAttribute(
"rec")); }
 
  154             if (n->getAttribute(
"pduSize") && atoi(n->getAttribute(
"pduSize")) > 0) {
 
  155                 pduS = atoi(n->getAttribute(
"pduSize")); }
 
  156             if(pduS < 50) { pduS = 50; }
 
  158             if (n->getAttribute(
"pduSizeVar") && atoi(n->getAttribute(
"pduSizeVar")) > 0) {
 
  159                 pduSv = atoi(n->getAttribute(
"pduSizeVar")); }
 
  160             if(pduSv > pduS) { pduSv = pduS - 1; }
 
  162             if (n->getAttribute(
"rate") && atof(n->getAttribute(
"rate")) > 0) {
 
  163                 rate = atof(n->getAttribute(
"rate")); }
 
  164             if(rate <= 0) { 
continue; }
 
  166             Flow * f = 
new Flow(DIF, SRC, DST, QoS, unitRate*rate, pduS, pduSv, N, rec);
 
  168             scheduleAt(iniT + uniform(0, pduS/unitRate), 
new commMsg(f));
 
  175     void Infection::handleMessage(cMessage *msg) {
 
  176         if(
commMsg * m = dynamic_cast<commMsg *>(msg)) {
 
  177             simtime_t now = simTime();
 
  178             if(now >= finTime) { 
delete msg; 
return; }
 
  180             bool record = now >= markIniT && now < markFinT;
 
  182             pduT k = m->f->getPDU(record);
 
  184             scheduleAt(now + k.
wT, msg);
 
  186             if(emitSignals) { emit(signal, 
new SendInfMsg(
 
  197     void Infection::finish() {
 
  198         for(
Flow * f : flows) { 
delete f; }
 
virtual void setNoLength(bool noLength)
virtual void setSduSeqNumPresent(bool sduSeqNumPresent)
const APN & getIpcAddress() const 
Getter of IPC Process address which should be unambiguous within DIF. 
virtual void setDstApn(const APN &dstApn)
virtual void setHopCount(unsigned int hopCount)
int getSrcCepId() const 
Getter of source Connection-Endpoint identifier. 
const std::string VAL_MGMTQOSID
virtual void setSrcAddr(const Address &srcAddr)
virtual ConnectionId & getConnId()
virtual void setDstAddr(const Address &dstAddr)
void setDstCepId(int destCepId)
Setter of destination Connection-Endpoint identifier. 
void setSduSeqNum(unsigned int sduSeqNum)
Flow()
Constructor for the flow with undefined values. 
virtual Address & getDstAddr()
virtual Address & getSrcAddr()
virtual void setSeqNum(unsigned int seqNum)
virtual void setSrcApn(const APN &srcApn)
virtual void setCompleteSDU(bool completeSDU)
void setQoSId(std::string qoSId)
Setter of selected QoS-cube identifier. 
const APN & getApn() const 
Getter of unique APN which is initialized during object construction. 
void setSrcCepId(int srcCepId)
Setter of source Connection-Endpoint identifier. 
const std::string & getName() const 
Gets APN string name representation. 
virtual void setConnId(const ConnectionId &connId)
Address class holds IPC Process identification.