View | Details | Raw Unified | Return to bug 2545
Collapse All | Expand All

(-)a/src/flow-monitor/helper/flow-monitor-helper.cc (-2 / +2 lines)
 Lines 146-152    Link Here 
146
}
146
}
147
147
148
void
148
void
149
FlowMonitorHelper::SerializeToXmlStream (std::ostream &os, int indent, bool enableHistograms, bool enableProbes)
149
FlowMonitorHelper::SerializeToXmlStream (std::ostream &os, uint16_t indent, bool enableHistograms, bool enableProbes)
150
{
150
{
151
  if (m_flowMonitor)
151
  if (m_flowMonitor)
152
    {
152
    {
 Lines 155-161    Link Here 
155
}
155
}
156
156
157
std::string
157
std::string
158
FlowMonitorHelper::SerializeToXmlString (int indent, bool enableHistograms, bool enableProbes)
158
FlowMonitorHelper::SerializeToXmlString (uint16_t indent, bool enableHistograms, bool enableProbes)
159
{
159
{
160
  std::ostringstream os;
160
  std::ostringstream os;
161
  if (m_flowMonitor)
161
  if (m_flowMonitor)
(-)a/src/flow-monitor/helper/flow-monitor-helper.h (-2 / +2 lines)
 Lines 93-99    Link Here 
93
   * \param enableHistograms if true, include also the histograms in the output
93
   * \param enableHistograms if true, include also the histograms in the output
94
   * \param enableProbes if true, include also the per-probe/flow pair statistics in the output
94
   * \param enableProbes if true, include also the per-probe/flow pair statistics in the output
95
   */
95
   */
96
  void SerializeToXmlStream (std::ostream &os, int indent, bool enableHistograms, bool enableProbes);
96
  void SerializeToXmlStream (std::ostream &os, uint16_t indent, bool enableHistograms, bool enableProbes);
97
97
98
  /**
98
  /**
99
   * Same as SerializeToXmlStream, but returns the output as a std::string
99
   * Same as SerializeToXmlStream, but returns the output as a std::string
 Lines 102-108    Link Here 
102
   * \param enableProbes if true, include also the per-probe/flow pair statistics in the output
102
   * \param enableProbes if true, include also the per-probe/flow pair statistics in the output
103
   * \return the XML output as string
103
   * \return the XML output as string
104
   */
104
   */
105
  std::string SerializeToXmlString (int indent, bool enableHistograms, bool enableProbes);
105
  std::string SerializeToXmlString (uint16_t indent, bool enableHistograms, bool enableProbes);
106
106
107
  /**
107
  /**
108
   * Same as SerializeToXmlStream, but writes to a file instead
108
   * Same as SerializeToXmlStream, but writes to a file instead
(-)a/src/flow-monitor/model/flow-classifier.h (-1 / +13 lines)
 Lines 69-83    Link Here 
69
  /// Serializes the results to an std::ostream in XML format
69
  /// Serializes the results to an std::ostream in XML format
70
  /// \param os the output stream
70
  /// \param os the output stream
71
  /// \param indent number of spaces to use as base indentation level
71
  /// \param indent number of spaces to use as base indentation level
72
  virtual void SerializeToXmlStream (std::ostream &os, int indent) const = 0;
72
  virtual void SerializeToXmlStream (std::ostream &os, uint16_t indent) const = 0;
73
73
74
protected:
74
protected:
75
  /// Returns a new, unique Flow Identifier
75
  /// Returns a new, unique Flow Identifier
76
  /// \returns a new FlowId
76
  /// \returns a new FlowId
77
  FlowId GetNewFlowId ();
77
  FlowId GetNewFlowId ();
78
78
79
  ///
80
  /// \brief Add a number of spaces for indentation purposes.
81
  /// \param os The stream to write to.
82
  /// \param level The number of spaces to add.
83
  void Indent (std::ostream &os, uint16_t level) const;
84
79
};
85
};
80
86
87
inline void
88
FlowClassifier::Indent (std::ostream &os, uint16_t level) const
89
{
90
  for (uint16_t __xpto = 0; __xpto < level; __xpto++) os << ' ';
91
}
92
81
93
82
} // namespace ns3
94
} // namespace ns3
83
95
(-)a/src/flow-monitor/model/flow-monitor.cc (-12 / +19 lines)
 Lines 36-41    Link Here 
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
{
 Lines 401-419    Link Here 
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)
 Lines 436-449    Link Here 
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";
 Lines 457-466    Link Here 
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 ();
 Lines 471-493    Link Here 
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);
(-)a/src/flow-monitor/model/flow-monitor.h (-2 / +2 lines)
 Lines 241-254    Link Here 
241
  /// \param indent number of spaces to use as base indentation level
241
  /// \param indent number of spaces to use as base indentation level
242
  /// \param enableHistograms if true, include also the histograms in the output
242
  /// \param enableHistograms if true, include also the histograms in the output
243
  /// \param enableProbes if true, include also the per-probe/flow pair statistics in the output
243
  /// \param enableProbes if true, include also the per-probe/flow pair statistics in the output
244
  void SerializeToXmlStream (std::ostream &os, int indent, bool enableHistograms, bool enableProbes);
244
  void SerializeToXmlStream (std::ostream &os, uint16_t indent, bool enableHistograms, bool enableProbes);
245
245
246
  /// Same as SerializeToXmlStream, but returns the output as a std::string
246
  /// Same as SerializeToXmlStream, but returns the output as a std::string
247
  /// \param indent number of spaces to use as base indentation level
247
  /// \param indent number of spaces to use as base indentation level
248
  /// \param enableHistograms if true, include also the histograms in the output
248
  /// \param enableHistograms if true, include also the histograms in the output
249
  /// \param enableProbes if true, include also the per-probe/flow pair statistics in the output
249
  /// \param enableProbes if true, include also the per-probe/flow pair statistics in the output
250
  /// \return the XML output as string
250
  /// \return the XML output as string
251
  std::string SerializeToXmlString (int indent, bool enableHistograms, bool enableProbes);
251
  std::string SerializeToXmlString (uint16_t indent, bool enableHistograms, bool enableProbes);
252
252
253
  /// Same as SerializeToXmlStream, but writes to a file instead
253
  /// Same as SerializeToXmlStream, but writes to a file instead
254
  /// \param fileName name or path of the output file that will be created
254
  /// \param fileName name or path of the output file that will be created
(-)a/src/flow-monitor/model/ipv4-flow-classifier.cc (-8 / +4 lines)
 Lines 186-202    Link Here 
186
}
186
}
187
187
188
void
188
void
189
Ipv4FlowClassifier::SerializeToXmlStream (std::ostream &os, int indent) const
189
Ipv4FlowClassifier::SerializeToXmlStream (std::ostream &os, uint16_t indent) const
190
{
190
{
191
#define INDENT(level) for (int __xpto = 0; __xpto < level; __xpto++) os << ' ';
191
  Indent (os, indent); os << "<Ipv4FlowClassifier>\n";
192
193
  INDENT (indent); os << "<Ipv4FlowClassifier>\n";
194
192
195
  indent += 2;
193
  indent += 2;
196
  for (std::map<FiveTuple, FlowId>::const_iterator
194
  for (std::map<FiveTuple, FlowId>::const_iterator
197
       iter = m_flowMap.begin (); iter != m_flowMap.end (); iter++)
195
       iter = m_flowMap.begin (); iter != m_flowMap.end (); iter++)
198
    {
196
    {
199
      INDENT (indent);
197
      Indent (os, indent);
200
      os << "<Flow flowId=\"" << iter->second << "\""
198
      os << "<Flow flowId=\"" << iter->second << "\""
201
         << " sourceAddress=\"" << iter->first.sourceAddress << "\""
199
         << " sourceAddress=\"" << iter->first.sourceAddress << "\""
202
         << " destinationAddress=\"" << iter->first.destinationAddress << "\""
200
         << " destinationAddress=\"" << iter->first.destinationAddress << "\""
 Lines 207-215    Link Here 
207
    }
205
    }
208
206
209
  indent -= 2;
207
  indent -= 2;
210
  INDENT (indent); os << "</Ipv4FlowClassifier>\n";
208
  Indent (os, indent); os << "</Ipv4FlowClassifier>\n";
211
212
#undef INDENT
213
}
209
}
214
210
215
211
(-)a/src/flow-monitor/model/ipv4-flow-classifier.h (-1 / +1 lines)
 Lines 69-75    Link Here 
69
  /// \returns the FiveTuple corresponding to flowId
69
  /// \returns the FiveTuple corresponding to flowId
70
  FiveTuple FindFlow (FlowId flowId) const;
70
  FiveTuple FindFlow (FlowId flowId) const;
71
71
72
  virtual void SerializeToXmlStream (std::ostream &os, int indent) const;
72
  virtual void SerializeToXmlStream (std::ostream &os, uint16_t indent) const;
73
73
74
private:
74
private:
75
75
(-)a/src/flow-monitor/model/ipv6-flow-classifier.cc (-7 / +4 lines)
 Lines 187-203    Link Here 
187
}
187
}
188
188
189
void
189
void
190
Ipv6FlowClassifier::SerializeToXmlStream (std::ostream &os, int indent) const
190
Ipv6FlowClassifier::SerializeToXmlStream (std::ostream &os, uint16_t indent) const
191
{
191
{
192
#define INDENT(level) for (int __xpto = 0; __xpto < level; __xpto++) os << ' ';
192
  Indent (os, indent); os << "<Ipv6FlowClassifier>\n";
193
194
  INDENT (indent); os << "<Ipv6FlowClassifier>\n";
195
193
196
  indent += 2;
194
  indent += 2;
197
  for (std::map<FiveTuple, FlowId>::const_iterator
195
  for (std::map<FiveTuple, FlowId>::const_iterator
198
       iter = m_flowMap.begin (); iter != m_flowMap.end (); iter++)
196
       iter = m_flowMap.begin (); iter != m_flowMap.end (); iter++)
199
    {
197
    {
200
      INDENT (indent);
198
      Indent (os, indent);
201
      os << "<Flow flowId=\"" << iter->second << "\""
199
      os << "<Flow flowId=\"" << iter->second << "\""
202
         << " sourceAddress=\"" << iter->first.sourceAddress << "\""
200
         << " sourceAddress=\"" << iter->first.sourceAddress << "\""
203
         << " destinationAddress=\"" << iter->first.destinationAddress << "\""
201
         << " destinationAddress=\"" << iter->first.destinationAddress << "\""
 Lines 208-216    Link Here 
208
    }
206
    }
209
207
210
  indent -= 2;
208
  indent -= 2;
211
  INDENT (indent); os << "</Ipv6FlowClassifier>\n";
209
  Indent (os, indent); os << "</Ipv6FlowClassifier>\n";
212
210
213
#undef INDENT
214
}
211
}
215
212
216
213
(-)a/src/flow-monitor/model/ipv6-flow-classifier.h (-1 / +1 lines)
 Lines 70-76    Link Here 
70
  /// \returns the FiveTuple corresponding to flowId
70
  /// \returns the FiveTuple corresponding to flowId
71
  FiveTuple FindFlow (FlowId flowId) const;
71
  FiveTuple FindFlow (FlowId flowId) const;
72
72
73
  virtual void SerializeToXmlStream (std::ostream &os, int indent) const;
73
  virtual void SerializeToXmlStream (std::ostream &os, uint16_t indent) const;
74
74
75
private:
75
private:
76
76

Return to bug 2545