24 void MM_WFQ_Drop::initialize() {
26 defaultThreshold = par(
"defThreshold").longValue();
27 if(defaultThreshold <= 0) { error(
"Error at DL_Drop. defThreshold must be >0!"); }
29 cXMLElement* Xml = NULL;
30 if (par(
"data").xmlValue() != NULL && par(
"data").xmlValue()->hasChildren()){
31 Xml = par(
"data").xmlValue();
35 cXMLElementList queues = Xml->getChildrenByTagName(
"queue");
36 for(
auto queue : queues){
37 if (!queue->getAttribute(
"id")) { error(
"Error parsing DL_Drop Queue. Its ID is missing!"); }
38 std::string
id = queue->getAttribute(
"id");
39 if (
id==
"") { error(
"Error parsing DL_Drop Queue. Queue ID cannot be empty!"); }
41 if (!queue->getAttribute(
"threshold")) { error(
"Error parsing DL_Drop Queue. Its Threshold is missing!"); }
42 int threshold = atoi(queue->getAttribute(
"threshold"));
43 if (threshold<=0) { error(
"Error parsing DL_Drop Queue. Queue Threshold must be >0!"); }
44 queueName2Threshold[id] = threshold;
48 MM_WFQ_Drop::~MM_WFQ_Drop(){
65 if(queueName2Threshold.find(q->getName()) != queueName2Threshold.end()) {
66 queueThreshold[q] = queueName2Threshold[q->getName()];
68 queueThreshold[q] = defaultThreshold;
74 return (queueThreshold[q] < queueCount[q])? 1.0 : 0.0;
Define_Module(MM_WFQ_Drop)