|
|
| 36 |
NS_OBJECT_ENSURE_REGISTERED (FlowMonitor); |
36 |
NS_OBJECT_ENSURE_REGISTERED (FlowMonitor); |
| 37 |
|
37 |
|
| 38 |
|
38 |
|
|
|
39 |
inline static void |
| 40 |
Indent (std::ostream &os, uint16_t level) |
| 41 |
{ |
| 42 |
for (uint16_t __xpto = 0; __xpto < level; __xpto++) os << ' '; |
| 43 |
} |
| 44 |
|
| 45 |
|
| 39 |
TypeId |
46 |
TypeId |
| 40 |
FlowMonitor::GetTypeId (void) |
47 |
FlowMonitor::GetTypeId (void) |
| 41 |
{ |
48 |
{ |
|
|
| 401 |
} |
408 |
} |
| 402 |
|
409 |
|
| 403 |
void |
410 |
void |
| 404 |
FlowMonitor::SerializeToXmlStream (std::ostream &os, int indent, bool enableHistograms, bool enableProbes) |
411 |
FlowMonitor::SerializeToXmlStream (std::ostream &os, uint16_t indent, bool enableHistograms, bool enableProbes) |
| 405 |
{ |
412 |
{ |
| 406 |
CheckForLostPackets (); |
413 |
CheckForLostPackets (); |
| 407 |
|
414 |
|
| 408 |
INDENT (indent); os << "<FlowMonitor>\n"; |
415 |
Indent (os, indent); os << "<FlowMonitor>\n"; |
| 409 |
indent += 2; |
416 |
indent += 2; |
| 410 |
INDENT (indent); os << "<FlowStats>\n"; |
417 |
Indent (os, indent); os << "<FlowStats>\n"; |
| 411 |
indent += 2; |
418 |
indent += 2; |
| 412 |
for (FlowStatsContainerCI flowI = m_flowStats.begin (); |
419 |
for (FlowStatsContainerCI flowI = m_flowStats.begin (); |
| 413 |
flowI != m_flowStats.end (); flowI++) |
420 |
flowI != m_flowStats.end (); flowI++) |
| 414 |
{ |
421 |
{ |
| 415 |
|
422 |
|
| 416 |
INDENT (indent); |
423 |
Indent (os, indent); |
| 417 |
#define ATTRIB(name) << " " # name "=\"" << flowI->second.name << "\"" |
424 |
#define ATTRIB(name) << " " # name "=\"" << flowI->second.name << "\"" |
| 418 |
os << "<Flow flowId=\"" << flowI->first << "\"" |
425 |
os << "<Flow flowId=\"" << flowI->first << "\"" |
| 419 |
ATTRIB (timeFirstTxPacket) |
426 |
ATTRIB (timeFirstTxPacket) |
|
|
| 436 |
indent += 2; |
443 |
indent += 2; |
| 437 |
for (uint32_t reasonCode = 0; reasonCode < flowI->second.packetsDropped.size (); reasonCode++) |
444 |
for (uint32_t reasonCode = 0; reasonCode < flowI->second.packetsDropped.size (); reasonCode++) |
| 438 |
{ |
445 |
{ |
| 439 |
INDENT (indent); |
446 |
Indent (os, indent); |
| 440 |
os << "<packetsDropped reasonCode=\"" << reasonCode << "\"" |
447 |
os << "<packetsDropped reasonCode=\"" << reasonCode << "\"" |
| 441 |
<< " number=\"" << flowI->second.packetsDropped[reasonCode] |
448 |
<< " number=\"" << flowI->second.packetsDropped[reasonCode] |
| 442 |
<< "\" />\n"; |
449 |
<< "\" />\n"; |
| 443 |
} |
450 |
} |
| 444 |
for (uint32_t reasonCode = 0; reasonCode < flowI->second.bytesDropped.size (); reasonCode++) |
451 |
for (uint32_t reasonCode = 0; reasonCode < flowI->second.bytesDropped.size (); reasonCode++) |
| 445 |
{ |
452 |
{ |
| 446 |
INDENT (indent); |
453 |
Indent (os, indent); |
| 447 |
os << "<bytesDropped reasonCode=\"" << reasonCode << "\"" |
454 |
os << "<bytesDropped reasonCode=\"" << reasonCode << "\"" |
| 448 |
<< " bytes=\"" << flowI->second.bytesDropped[reasonCode] |
455 |
<< " bytes=\"" << flowI->second.bytesDropped[reasonCode] |
| 449 |
<< "\" />\n"; |
456 |
<< "\" />\n"; |
|
|
| 457 |
} |
464 |
} |
| 458 |
indent -= 2; |
465 |
indent -= 2; |
| 459 |
|
466 |
|
| 460 |
INDENT (indent); os << "</Flow>\n"; |
467 |
Indent (os, indent); os << "</Flow>\n"; |
| 461 |
} |
468 |
} |
| 462 |
indent -= 2; |
469 |
indent -= 2; |
| 463 |
INDENT (indent); os << "</FlowStats>\n"; |
470 |
Indent (os, indent); os << "</FlowStats>\n"; |
| 464 |
|
471 |
|
| 465 |
for (std::list<Ptr<FlowClassifier> >::iterator iter = m_classifiers.begin (); |
472 |
for (std::list<Ptr<FlowClassifier> >::iterator iter = m_classifiers.begin (); |
| 466 |
iter != m_classifiers.end (); |
473 |
iter != m_classifiers.end (); |
|
|
| 471 |
|
478 |
|
| 472 |
if (enableProbes) |
479 |
if (enableProbes) |
| 473 |
{ |
480 |
{ |
| 474 |
INDENT (indent); os << "<FlowProbes>\n"; |
481 |
Indent (os, indent); os << "<FlowProbes>\n"; |
| 475 |
indent += 2; |
482 |
indent += 2; |
| 476 |
for (uint32_t i = 0; i < m_flowProbes.size (); i++) |
483 |
for (uint32_t i = 0; i < m_flowProbes.size (); i++) |
| 477 |
{ |
484 |
{ |
| 478 |
m_flowProbes[i]->SerializeToXmlStream (os, indent, i); |
485 |
m_flowProbes[i]->SerializeToXmlStream (os, indent, i); |
| 479 |
} |
486 |
} |
| 480 |
indent -= 2; |
487 |
indent -= 2; |
| 481 |
INDENT (indent); os << "</FlowProbes>\n"; |
488 |
Indent (os, indent); os << "</FlowProbes>\n"; |
| 482 |
} |
489 |
} |
| 483 |
|
490 |
|
| 484 |
indent -= 2; |
491 |
indent -= 2; |
| 485 |
INDENT (indent); os << "</FlowMonitor>\n"; |
492 |
Indent (os, indent); os << "</FlowMonitor>\n"; |
| 486 |
} |
493 |
} |
| 487 |
|
494 |
|
| 488 |
|
495 |
|
| 489 |
std::string |
496 |
std::string |
| 490 |
FlowMonitor::SerializeToXmlString (int indent, bool enableHistograms, bool enableProbes) |
497 |
FlowMonitor::SerializeToXmlString (uint16_t indent, bool enableHistograms, bool enableProbes) |
| 491 |
{ |
498 |
{ |
| 492 |
std::ostringstream os; |
499 |
std::ostringstream os; |
| 493 |
SerializeToXmlStream (os, indent, enableHistograms, enableProbes); |
500 |
SerializeToXmlStream (os, indent, enableHistograms, enableProbes); |