40 void MM_DQ_Drop::initialize() {
42 defaultThreshold = par(
"defaultThreshold").longValue();
43 if(defaultThreshold < 0) { error(
"Error at DL_Drop. defThreshold must be >= 0!"); }
45 cXMLElement* Xml = NULL;
46 if (par(
"data").xmlValue() != NULL && par(
"data").xmlValue()->hasChildren()){
47 Xml = par(
"data").xmlValue();
50 cXMLElementList queues = Xml->getChildrenByTagName(
"queue");
51 for(
auto queue : queues){
52 if (!queue->getAttribute(
"id")) { error(
"Error parsing DQ_Drop Queue. Its ID is missing!"); }
53 std::string
id = queue->getAttribute(
"id");
54 if (
id==
"") { error(
"Error parsing DQ_Drop Queue. Queue ID cannot be empty!"); }
56 if (!queue->getAttribute(
"absThreshold")) { error(
"Error parsing DQ_Drop Queue. Its absThreshold is missing!"); }
57 int absThreshold = atoi(queue->getAttribute(
"absThreshold"));
58 if (absThreshold<0) { error(
"Error parsing DQ_Drop Queue. Queue absThreshold must be >=0!"); }
62 cXMLElementList THs = queue->getChildrenByTagName(
"TH");
65 if(!TH->getAttribute(
"threshold")) { error(
"Error parsing TH. threshold must be defined!"); }
66 int threshold = atoi(TH->getAttribute(
"threshold"));
67 if(threshold<0) { error(
"Error parsing PP. threshold must be >=0!"); }
68 if(absThreshold<=threshold) {
continue; }
70 if(!TH->getAttribute(
"dropProb")) { error(
"Error parsing TH. dropProb must be defined!"); }
71 double dropProb = atof(TH->getAttribute(
"dropProb"));
72 if(dropProb<=0 || dropProb>=1) { error(
"Error parsing TH. dropProb must be in (0,1)!"); }
81 MM_DQ_Drop::~MM_DQ_Drop(){
98 if(queuesConf.find(q->getName()) != queuesConf.end()) {
99 queueConf[q] = &queuesConf[q->getName()];
104 portQueues[p].insert(q);
108 int count = portCount[p];
128 void MM_DQ_Drop::finish() {
Define_Module(MM_DQ_Drop)
vector< Threshold > thresholdList