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

(-)a/src/helper/internet-stack-helper.cc (+30 lines)
 Lines 92-97   InternetStackHelper::Install (Ptr<Node> Link Here 
92
}
92
}
93
93
94
void
94
void
95
InternetStackHelper::EnableAscii (std::ostream &os, NodeContainer n)
96
{
97
  Packet::EnablePrinting ();
98
  std::ostringstream oss;
99
  for (NodeContainer::Iterator i = n.Begin (); i != n.End (); ++i)
100
    {
101
      Ptr<Node> node = *i;
102
      oss << "/NodeList/" << node->GetId () << "/$ns3::Ipv4L3Protocol/Drop";
103
      Config::Connect (oss.str (), MakeBoundCallback (&InternetStackHelper::AsciiDropEvent, &os));
104
      oss.str ("");
105
      oss << "/NodeList/" << node->GetId () << "/$ns3::ArpL3Protocol/Drop";
106
      Config::Connect (oss.str (), MakeBoundCallback (&InternetStackHelper::AsciiDropEvent, &os));
107
      oss.str ("");
108
    }
109
}
110
111
void
112
InternetStackHelper::EnableAsciiAll (std::ostream &os)
113
{
114
  EnableAscii (os, NodeContainer::GetGlobal ());
115
}
116
117
void
95
InternetStackHelper::EnablePcapAll (std::string filename)
118
InternetStackHelper::EnablePcapAll (std::string filename)
96
{
119
{
97
  Simulator::ScheduleDestroy (&InternetStackHelper::Cleanup);
120
  Simulator::ScheduleDestroy (&InternetStackHelper::Cleanup);
 Lines 157-160   InternetStackHelper::GetStream (uint32_t Link Here 
157
  return trace.writer;
180
  return trace.writer;
158
}
181
}
159
182
183
void
184
InternetStackHelper::AsciiDropEvent (std::ostream *os, std::string path, Ptr<const Packet> packet)
185
{
186
  *os << "d " << Simulator::Now ().GetSeconds () << " ";
187
  *os << path << " " << *packet << std::endl;
188
}
189
160
} // namespace ns3
190
} // namespace ns3
(-)a/src/helper/internet-stack-helper.h (+20 lines)
 Lines 70-75   public: Link Here 
70
  void SetNscStack(std::string soname);
70
  void SetNscStack(std::string soname);
71
71
72
  /**
72
  /**
73
   * \param os output stream
74
   * \param n node container
75
   *
76
   * Enable ascii output on these drop traces, for each node in the NodeContainer..
77
   * /NodeList/[i]/$ns3ArpL3Protocol/Drop 
78
   * /NodeList/[i]/$ns3Ipv4L3Protocol/Drop 
79
   */
80
  static void EnableAscii (std::ostream &os, NodeContainer n);
81
82
  /**
83
   * \param os output stream
84
   *
85
   * Enable ascii output on these drop traces, for all nodes.
86
   * /NodeList/[i]/$ns3ArpL3Protocol/Drop 
87
   * /NodeList/[i]/$ns3Ipv4L3Protocol/Drop 
88
   */
89
  static void EnableAsciiAll (std::ostream &os);
90
91
  /**
73
   * Enable pcap output on each protocol instance which is of the
92
   * Enable pcap output on each protocol instance which is of the
74
   * ns3::Ipv4L3Protocol type.  Both Tx and Rx events will be logged.
93
   * ns3::Ipv4L3Protocol type.  Both Tx and Rx events will be logged.
75
   *
94
   *
 Lines 95-100   private: Link Here 
95
    uint32_t interfaceId;
114
    uint32_t interfaceId;
96
    Ptr<PcapWriter> writer;
115
    Ptr<PcapWriter> writer;
97
  };
116
  };
117
  static void AsciiDropEvent (std::ostream *os, std::string path, Ptr<const Packet> packet);
98
  static std::string m_pcapBaseFilename;
118
  static std::string m_pcapBaseFilename;
99
  static uint32_t GetNodeIndex (std::string context);
119
  static uint32_t GetNodeIndex (std::string context);
100
  static std::vector<Trace> m_traces;
120
  static std::vector<Trace> m_traces;

Return to bug 401