Left: | ||
Right: |
OLD | NEW |
---|---|
(Empty) | |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | |
2 /* | |
3 * Copyright (c) 2010 University of Washington | |
4 * | |
5 * This program is free software; you can redistribute it and/or modify | |
6 * it under the terms of the GNU General Public License version 2 as | |
7 * published by the Free Software Foundation; | |
8 * | |
9 * This program is distributed in the hope that it will be useful, | |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 * GNU General Public License for more details. | |
13 * | |
14 * You should have received a copy of the GNU General Public License | |
15 * along with this program; if not, write to the Free Software | |
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
17 */ | |
18 | |
19 #ifndef TRACE_HELPER_H | |
20 #define TRACE_HELPER_H | |
21 | |
22 #include "ns3/assert.h" | |
23 #include "ns3/net-device-container.h" | |
24 #include "ns3/ipv4-interface-container.h" | |
25 #include "ns3/ipv6-interface-container.h" | |
26 #include "ns3/node-container.h" | |
27 #include "ns3/simulator.h" | |
28 #include "ns3/pcap-file-object.h" | |
29 #include "ns3/output-stream-object.h" | |
30 #include "ns3/ipv4.h" | |
31 #include "ns3/ipv6.h" | |
32 | |
33 namespace ns3 { | |
34 | |
35 /** | |
36 * \brief Manage pcap files for device models | |
37 * | |
38 * Handling pcap files is a common operation for ns-3 devices. It is useful to | |
39 * provide a common base class for dealing with these ops. | |
40 */ | |
41 | |
42 class PcapHelper | |
43 { | |
44 public: | |
45 // | |
46 // These are the data link types that will be written to the pcap file. We | |
47 // don't include pcap-bpf.h to avoid an explicit dependency on the real pcap | |
48 // and we don't make an enumeration of all of the values to make it easy to | |
49 // pass new values in. | |
50 // | |
51 enum {DLT_NULL = 0}; | |
52 enum {DLT_EN10MB = 1}; | |
53 enum {DLT_PPP = 9}; | |
54 enum {DLT_RAW = 101}; | |
55 enum {DLT_IEEE802_11 = 105}; | |
56 enum {DLT_PRISM_HEADER = 119}; | |
57 enum {DLT_IEEE802_11_RADIO = 127}; | |
Tom Henderson
2010/02/03 15:05:10
I favor using the DLT_ constants as introduced by
| |
58 | |
59 /** | |
60 * @brief Create a pcap helper. | |
61 */ | |
62 PcapHelper (); | |
63 | |
64 /** | |
65 * @brief Destroy a pcap helper. | |
66 */ | |
67 ~PcapHelper (); | |
68 | |
69 /** | |
70 * @brief Let the pcap helper figure out a reasonable filename to use for a | |
71 * pcap file associated with a device. | |
72 */ | |
73 std::string GetFilenameFromDevice (std::string prefix, Ptr<NetDevice> device, bool useObjectNames = true); | |
74 | |
75 /** | |
76 * @brief Let the pcap helper figure out a reasonable filename to use for the | |
77 * pcap file associated with a node. | |
78 */ | |
79 std::string GetFilenameFromInterfacePair (std::string prefix, Ptr<Object> obje ct,· | |
80 uint32_t interface, bool useObjectNa mes = true); | |
81 | |
82 /** | |
83 * @brief Create and initialize a pcap file. | |
84 */ | |
85 Ptr<PcapFileObject> CreateFile (std::string filename, std::string filemode, | |
86 uint32_t dataLinkType, uint32_t snapLen = 655 35, int32_t tzCorrection = 0); | |
87 /** | |
88 * @brief Hook a trace source to the default trace sink | |
89 */ | |
90 template <typename T> void HookDefaultSink (Ptr<T> object, std::string traceNa me, Ptr<PcapFileObject> file); | |
91 | |
92 private: | |
93 static void DefaultSink (Ptr<PcapFileObject> file, Ptr<const Packet> p); | |
94 }; | |
95 | |
96 template <typename T> void | |
97 PcapHelper::HookDefaultSink (Ptr<T> object, std::string tracename, Ptr<PcapFileO bject> file) | |
98 { | |
99 bool result = object->TraceConnectWithoutContext (tracename.c_str (), MakeBoun dCallback (&DefaultSink, file)); | |
100 NS_ASSERT_MSG (result == true, "PcapHelper::HookDefaultSink(): Unable to hook \"" << tracename << "\""); | |
101 } | |
102 | |
103 /** | |
104 * \brief Manage ASCII trace files for device models | |
105 * | |
106 * Handling ascii trace files is a common operation for ns-3 devices. It is· | |
107 * useful to provide a common base class for dealing with these ops. | |
108 */ | |
109 | |
110 class AsciiTraceHelper | |
111 { | |
112 public: | |
113 /** | |
114 * @brief Create an ascii trace helper. | |
115 */ | |
116 AsciiTraceHelper (); | |
117 | |
118 /** | |
119 * @brief Destroy an ascii trace helper. | |
120 */ | |
121 ~AsciiTraceHelper (); | |
122 | |
123 /** | |
124 * @brief Let the ascii trace helper figure out a reasonable filename to use | |
125 * for an ascii trace file associated with a device. | |
126 */ | |
127 std::string GetFilenameFromDevice (std::string prefix, Ptr<NetDevice> device, bool useObjectNames = true); | |
128 | |
129 /** | |
130 * @brief Let the ascii trace helper figure out a reasonable filename to use | |
131 * for an ascii trace file associated with a node. | |
132 */ | |
133 std::string GetFilenameFromInterfacePair (std::string prefix, Ptr<Object> obje ct,· | |
134 uint32_t interface, bool useObjectNa mes = true); | |
135 | |
136 /** | |
137 * @brief Create and initialize an output stream object we'll use to write the········ | |
138 * traced bits. | |
139 * | |
140 * One of the common issues users run into when trying to use tracing in ns-3 | |
141 * is actually a design decision made in the C++ stream library. It is not· | |
142 * widely known that copy and assignment of iostreams is forbidden by· | |
143 * std::basic_ios<>. This is because it is not possible to predict the· | |
144 * semantics of the stream desired by a user. | |
145 * | |
146 * The tempting ns-3 idiom when tracing to a file is to create a bound callbac k | |
147 * with an ofstream as the bound object. Unfortunately, this implies a copy· | |
148 * construction in order to get the ofstream object into the callback. This· | |
149 * operation, as mentioned above, is forbidden by the STL. You could use a· | |
150 * global ostream and pass a pointer to it, but that is pretty ugly. You· | |
151 * could create an ostream on the stack and pass a pointer to it, but you may | |
152 * run into object lifetime issues. Ns-3 has a nice reference counted object | |
153 * that can solve the problem so we use one of those to carry the stream | |
154 * around and deal with the lifetime issues. | |
155 */ | |
156 Ptr<OutputStreamObject> CreateFileStream (std::string filename, std::string fi lemode = "w"); | |
Mathieu Lacage
2010/01/29 10:29:29
Is there a reason why you did not use/extend Ascii
craigdo
2010/02/01 21:15:11
I want a low-lvel thing that is agnostic about wha
| |
157 | |
158 /** | |
159 * @brief Hook a trace source to the default enqueue operation trace sink that | |
160 * does not accept nor log a trace context. | |
161 */ | |
162 template <typename T>· | |
163 void HookDefaultEnqueueSinkWithoutContext (Ptr<T> object, std::string traceNam e, Ptr<OutputStreamObject> stream); | |
164 | |
165 /** | |
166 * @brief Hook a trace source to the default enqueue operation trace sink that | |
167 * does accept and log a trace context. | |
168 */ | |
169 template <typename T>· | |
170 void HookDefaultEnqueueSinkWithContext (Ptr<T> object,· | |
171 std::string context, std::string trace Name, Ptr<OutputStreamObject> stream); | |
172 | |
173 /** | |
174 * @brief Hook a trace source to the default drop operation trace sink that· | |
175 * does not accept nor log a trace context. | |
176 */ | |
177 template <typename T>· | |
178 void HookDefaultDropSinkWithoutContext (Ptr<T> object, std::string traceName, Ptr<OutputStreamObject> stream); | |
179 | |
180 /** | |
181 * @brief Hook a trace source to the default drop operation trace sink that· | |
182 * does accept and log a trace context. | |
183 */ | |
184 template <typename T>· | |
185 void HookDefaultDropSinkWithContext (Ptr<T> object,· | |
186 std::string context, std::string traceNam e, Ptr<OutputStreamObject> stream); | |
187 | |
188 /** | |
189 * @brief Hook a trace source to the default dequeue operation trace sink | |
190 * that does not accept nor log a trace context. | |
191 */ | |
192 template <typename T>· | |
193 void HookDefaultDequeueSinkWithoutContext (Ptr<T> object, std::string traceNam e, Ptr<OutputStreamObject> stream); | |
194 | |
195 /** | |
196 * @brief Hook a trace source to the default dequeue operation trace sink | |
197 * that does accept and log a trace context. | |
198 */ | |
199 template <typename T>· | |
200 void HookDefaultDequeueSinkWithContext (Ptr<T> object,· | |
201 std::string context, std::string trace Name, Ptr<OutputStreamObject> stream); | |
202 | |
203 /** | |
204 * @brief Hook a trace source to the default receive operation trace sink | |
205 * that does not accept nor log a trace context. | |
206 */ | |
207 template <typename T>· | |
208 void HookDefaultReceiveSinkWithoutContext (Ptr<T> object, std::string traceNam e, Ptr<OutputStreamObject> stream); | |
209 | |
210 /** | |
211 * @brief Hook a trace source to the default receive operation trace sink | |
212 * that does accept and log a trace context. | |
213 */ | |
214 template <typename T>· | |
215 void HookDefaultReceiveSinkWithContext (Ptr<T> object,· | |
216 std::string context, std::string trace Name, Ptr<OutputStreamObject> stream); | |
217 | |
218 static void DefaultEnqueueSinkWithoutContext (Ptr<OutputStreamObject> file, Pt r<const Packet> p); | |
219 static void DefaultEnqueueSinkWithContext (Ptr<OutputStreamObject> file, std:: string context, Ptr<const Packet> p); | |
220 | |
221 static void DefaultDropSinkWithoutContext (Ptr<OutputStreamObject> file, Ptr<c onst Packet> p); | |
222 static void DefaultDropSinkWithContext (Ptr<OutputStreamObject> file, std::str ing context, Ptr<const Packet> p); | |
223 | |
224 static void DefaultDequeueSinkWithoutContext (Ptr<OutputStreamObject> file, Pt r<const Packet> p); | |
225 static void DefaultDequeueSinkWithContext (Ptr<OutputStreamObject> file, std:: string context, Ptr<const Packet> p); | |
226 | |
227 static void DefaultReceiveSinkWithoutContext (Ptr<OutputStreamObject> file, Pt r<const Packet> p); | |
228 static void DefaultReceiveSinkWithContext (Ptr<OutputStreamObject> file, std:: string context, Ptr<const Packet> p); | |
229 }; | |
230 | |
231 template <typename T> void | |
232 AsciiTraceHelper::HookDefaultEnqueueSinkWithoutContext (Ptr<T> object, std::stri ng tracename, Ptr<OutputStreamObject> file) | |
233 { | |
234 bool result = object->TraceConnectWithoutContext (tracename,· | |
235 MakeBoundCallback (&DefaultE nqueueSinkWithoutContext, file)); | |
236 NS_ASSERT_MSG (result == true, "AsciiTraceHelper::HookDefaultEnqueueSinkWithou tContext(): Unable to hook \""· | |
237 << tracename << "\""); | |
238 } | |
239 | |
240 template <typename T> void | |
241 AsciiTraceHelper::HookDefaultEnqueueSinkWithContext ( | |
242 Ptr<T> object,· | |
243 std::string context,· | |
244 std::string tracename,· | |
245 Ptr<OutputStreamObject> stream) | |
246 { | |
247 bool result = object->TraceConnect (tracename, context, MakeBoundCallback (&De faultEnqueueSinkWithContext, stream)); | |
248 NS_ASSERT_MSG (result == true, "AsciiTraceHelper::HookDefaultEnqueueSinkWithCo ntext(): Unable to hook \""· | |
249 << tracename << "\""); | |
250 } | |
251 | |
252 template <typename T> void | |
253 AsciiTraceHelper::HookDefaultDropSinkWithoutContext (Ptr<T> object, std::string tracename, Ptr<OutputStreamObject> file) | |
254 { | |
255 bool result = object->TraceConnectWithoutContext (tracename,· | |
256 MakeBoundCallback (&DefaultD ropSinkWithoutContext, file)); | |
257 NS_ASSERT_MSG (result == true, "AsciiTraceHelper::HookDefaultDropSinkWithoutCo ntext(): Unable to hook \""· | |
258 << tracename << "\""); | |
259 } | |
260 | |
261 template <typename T> void | |
262 AsciiTraceHelper::HookDefaultDropSinkWithContext ( | |
263 Ptr<T> object,· | |
264 std::string context, | |
265 std::string tracename,· | |
266 Ptr<OutputStreamObject> stream) | |
267 { | |
268 bool result = object->TraceConnect (tracename, context, MakeBoundCallback (&De faultDropSinkWithContext, stream)); | |
269 NS_ASSERT_MSG (result == true, "AsciiTraceHelper::HookDefaultDropSinkWithConte xt(): Unable to hook \""· | |
270 << tracename << "\""); | |
271 } | |
272 | |
273 template <typename T> void | |
274 AsciiTraceHelper::HookDefaultDequeueSinkWithoutContext (Ptr<T> object, std::stri ng tracename, Ptr<OutputStreamObject> file) | |
275 { | |
276 bool result = object->TraceConnectWithoutContext (tracename,· | |
277 MakeBoundCallback (&DefaultD equeueSinkWithoutContext, file)); | |
278 NS_ASSERT_MSG (result == true, "AsciiTraceHelper::HookDefaultDequeueSinkWithou tContext(): Unable to hook \""· | |
279 << tracename << "\""); | |
280 } | |
281 | |
282 template <typename T> void | |
283 AsciiTraceHelper::HookDefaultDequeueSinkWithContext ( | |
284 Ptr<T> object,· | |
285 std::string context, | |
286 std::string tracename,· | |
287 Ptr<OutputStreamObject> stream) | |
288 { | |
289 bool result = object->TraceConnect (tracename, context, MakeBoundCallback (&De faultDequeueSinkWithContext, stream)); | |
290 NS_ASSERT_MSG (result == true, "AsciiTraceHelper::HookDefaultDequeueSinkWithCo ntext(): Unable to hook \""· | |
291 << tracename << "\""); | |
292 } | |
293 | |
294 template <typename T> void | |
295 AsciiTraceHelper::HookDefaultReceiveSinkWithoutContext (Ptr<T> object, std::stri ng tracename, Ptr<OutputStreamObject> file) | |
296 { | |
297 bool result = object->TraceConnectWithoutContext (tracename,· | |
298 MakeBoundCallback (&DefaultR eceiveSinkWithoutContext, file)); | |
299 NS_ASSERT_MSG (result == true, "AsciiTraceHelper::HookDefaultReceiveSinkWithou tContext(): Unable to hook \""· | |
300 << tracename << "\""); | |
301 } | |
302 | |
303 template <typename T> void | |
304 AsciiTraceHelper::HookDefaultReceiveSinkWithContext ( | |
305 Ptr<T> object,· | |
306 std::string context, | |
307 std::string tracename,· | |
308 Ptr<OutputStreamObject> stream) | |
309 { | |
310 bool result = object->TraceConnect (tracename, context, MakeBoundCallback (&De faultReceiveSinkWithContext, stream)); | |
311 NS_ASSERT_MSG (result == true, "AsciiTraceHelper::HookDefaultReceiveSinkWithCo ntext(): Unable to hook \""· | |
312 << tracename << "\""); | |
313 } | |
314 | |
315 /** | |
316 * \brief Base class providing common user-level pcap operations for helpers | |
317 * representing net devices. | |
318 */ | |
319 class PcapHelperForDevice | |
320 { | |
321 public: | |
322 /** | |
323 * @brief Enable pcap output the indicated net device. | |
324 * @internal | |
325 * | |
326 * @param prefix Filename prefix to use for pcap files. | |
327 * @param nd Net device for which you want to enable tracing. | |
328 * @param promiscuous If true capture all possible packets available at the de vice. | |
329 */ | |
330 virtual void EnablePcapInternal (std::string prefix, Ptr<NetDevice> nd, bool p romiscuous) = 0; | |
331 | |
332 /** | |
333 * @brief Enable pcap output the indicated net device. | |
334 * | |
335 * @param prefix Filename prefix to use for pcap files. | |
336 * @param nd Net device for which you want to enable tracing. | |
337 * @param promiscuous If true capture all possible packets available at the de vice. | |
338 */ | |
339 void EnablePcap (std::string prefix, Ptr<NetDevice> nd, bool promiscuous = fal se); | |
340 | |
341 /** | |
342 * @brief Enable pcap output the indicated net device using a device previousl y | |
343 * named using the ns-3 object name service. | |
344 * | |
345 * @param filename filename prefix to use for pcap files. | |
346 * @param ndName The name of the net device in which you want to enable tracin g. | |
347 * @param promiscuous If true capture all possible packets available at the de vice. | |
348 */ | |
349 void EnablePcap (std::string prefix, std::string ndName, bool promiscuous = fa lse); | |
350 | |
351 /** | |
352 * @brief Enable pcap output on each device in the container which is of the· | |
353 * appropriate type. | |
354 * | |
355 * @param prefix Filename prefix to use for pcap files. | |
356 * @param d container of devices of type ns3::CsmaNetDevice | |
357 * @param promiscuous If true capture all possible packets available at the de vice. | |
358 */ | |
359 void EnablePcap (std::string prefix, NetDeviceContainer d, bool promiscuous = false); | |
360 | |
361 /** | |
362 * @brief Enable pcap output on each device (which is of the appropriate type) | |
363 * in the nodes provided in the container. | |
364 * | |
365 * \param prefix Filename prefix to use for pcap files. | |
366 * \param n container of nodes. | |
367 * \param promiscuous If true capture all possible packets available at the de vice. | |
368 */ | |
369 void EnablePcap (std::string prefix, NodeContainer n, bool promiscuous = false ); | |
370 | |
371 /** | |
372 * @brief Enable pcap output on the device specified by a global node-id (of | |
373 * a previously created node) and associated device-id. | |
374 * | |
375 * @param prefix Filename prefix to use for pcap files. | |
376 * @param promiscuous If true capture all possible packets available at the de vice. | |
377 */ | |
378 void EnablePcap (std::string prefix, uint32_t nodeid, uint32_t deviceid, bool promiscuous = false); | |
379 | |
380 /** | |
381 * @brief Enable pcap output on each device (which is of the appropriate type) | |
382 * in the set of all nodes created in the simulation. | |
383 * | |
384 * @param prefix Filename prefix to use for pcap files. | |
385 * @param promiscuous If true capture all possible packets available at the de vice. | |
386 */ | |
387 void EnablePcapAll (std::string prefix, bool promiscuous = false); | |
388 }; | |
389 | |
390 /** | |
391 * @brief Class providing common pcap and ascii trace operations for helpers | |
392 * working with devices. | |
393 * | |
394 * It would be nice to make this class completely independent of the pcap | |
395 * trace helper for devices, but pybindgen doesn't support multiple inheritance | |
396 * no matter how well behaved, so even mixins are out of the question. Because | |
397 * of this, we have a hierarchy of tracing functionality that devices can | |
398 * add. If your device helper inherits from PcapHelperForDevice, you get pcap | |
399 * tracing. If your device helper inherits from TraceHelperForDevice, you | |
400 * get both ascii and pcap tracing. | |
401 */ | |
402 class TraceHelperForDevice : public PcapHelperForDevice | |
403 { | |
404 public: | |
405 /** | |
406 * @brief Enable ascii trace output on the indicated net device. | |
407 * @internal | |
408 * | |
409 * The implementation is expected to use a provided Ptr<OutputStreamObject> | |
410 * if it is non-null. If the OutputStreamObject is null, the implementation | |
411 * is expected to use a provided prefix to construct a new file name for | |
412 * each net device using the rules described in the class overview. | |
413 * | |
414 * If the prefix is provided, there will be one file per net device created. | |
415 * In this case, adding a trace context to the file would be pointless, so | |
416 * the device implementation is expected to TraceConnectWithoutContext. | |
417 * | |
418 * If the output stream object is provided, there may be many different· | |
419 * devices writing to a single file. In this case, the device adding a· | |
420 * trace context could be important, so the device implementation is· | |
421 * expected to TraceConnect. | |
422 * | |
423 * @param stream An OutputStreamObject representing an existing file to use | |
424 * when writing trace data. | |
425 * @param prefix Filename prefix to use for ascii trace files. | |
426 * @param nd Net device for which you want to enable tracing. | |
427 */ | |
428 virtual void EnableAsciiInternal (Ptr<OutputStreamObject> stream, std::string prefix, Ptr<NetDevice> nd) = 0; | |
429 | |
430 /** | |
431 * @brief Enable ascii trace output on the indicated net device. | |
432 * | |
433 * @param prefix Filename prefix to use for ascii files. | |
434 * @param nd Net device for which you want to enable tracing. | |
435 */ | |
436 void EnableAscii (std::string prefix, Ptr<NetDevice> nd); | |
437 | |
438 /** | |
439 * @brief Enable ascii trace output on the indicated net device. | |
440 * | |
441 * @param stream An OutputStreamObject representing an existing file to use | |
442 * when writing trace data. | |
443 * @param nd Net device for which you want to enable tracing. | |
444 */ | |
445 void EnableAscii (Ptr<OutputStreamObject> stream, Ptr<NetDevice> nd); | |
446 | |
447 /** | |
448 * @brief Enable ascii trace output the indicated net device using a device· | |
449 * previously named using the ns-3 object name service. | |
450 * | |
451 * @param filename filename prefix to use for ascii files. | |
452 * @param ndName The name of the net device in which you want to enable tracin g. | |
453 */ | |
454 void EnableAscii (std::string prefix, std::string ndName); | |
455 | |
456 /** | |
457 * @brief Enable ascii trace output the indicated net device using a device· | |
458 * previously named using the ns-3 object name service. | |
459 * | |
460 * @param stream An OutputStreamObject representing an existing file to use | |
461 * when writing trace data. | |
462 * @param ndName The name of the net device in which you want to enable tracin g. | |
463 */ | |
464 void EnableAscii (Ptr<OutputStreamObject> stream, std::string ndName); | |
465 | |
466 /** | |
467 * @brief Enable ascii trace output on each device in the container which is | |
468 * of the appropriate type. | |
469 * | |
470 * @param prefix Filename prefix to use for ascii files. | |
471 * @param d container of devices of type ns3::CsmaNetDevice | |
472 */ | |
473 void EnableAscii (std::string prefix, NetDeviceContainer d); | |
474 | |
475 /** | |
476 * @brief Enable ascii trace output on each device in the container which is | |
477 * of the appropriate type. | |
478 * | |
479 * @param stream An OutputStreamObject representing an existing file to use | |
480 * when writing trace data. | |
481 * @param d container of devices of type ns3::CsmaNetDevice | |
482 */ | |
483 void EnableAscii (Ptr<OutputStreamObject> stream, NetDeviceContainer d); | |
484 | |
485 /** | |
486 * @brief Enable ascii trace output on each device (which is of the· | |
487 * appropriate type) in the nodes provided in the container. | |
488 * | |
489 * \param prefix Filename prefix to use for ascii files. | |
490 * \param n container of nodes. | |
491 */ | |
492 void EnableAscii (std::string prefix, NodeContainer n); | |
493 | |
494 /** | |
495 * @brief Enable ascii trace output on each device (which is of the· | |
496 * appropriate type) in the nodes provided in the container. | |
497 * | |
498 * @param stream An OutputStreamObject representing an existing file to use | |
499 * when writing trace data. | |
500 * \param n container of nodes. | |
501 */ | |
502 void EnableAscii (Ptr<OutputStreamObject> stream, NodeContainer n); | |
503 | |
504 /** | |
505 * @brief Enable ascii trace output on each device (which is of the | |
506 * appropriate type) in the set of all nodes created in the simulation. | |
507 * | |
508 * @param prefix Filename prefix to use for ascii files. | |
509 */ | |
510 void EnableAsciiAll (std::string prefix); | |
511 | |
512 /** | |
513 * @brief Enable ascii trace output on each device (which is of the | |
514 * appropriate type) in the set of all nodes created in the simulation. | |
515 * | |
516 * @param stream An OutputStreamObject representing an existing file to use | |
517 * when writing trace data. | |
518 */ | |
519 void EnableAsciiAll (Ptr<OutputStreamObject> stream); | |
520 | |
521 /** | |
522 * @brief Enable ascii trace output on the device specified by a global· | |
523 * node-id (of a previously created node) and associated device-id. | |
524 * | |
525 * @param prefix Filename prefix to use when creating ascii trace files | |
526 * @param nodeid The node identifier/number of the node on which to enable | |
527 * ascii tracing | |
528 * @param deviceid The device identifier/index of the device on which to enabl e | |
529 * ascii tracing | |
530 */ | |
531 void EnableAscii (std::string prefix, uint32_t nodeid, uint32_t deviceid); | |
532 | |
533 /** | |
534 * @brief Enable ascii trace output on the device specified by a global· | |
535 * node-id (of a previously created node) and associated device-id. | |
536 * | |
537 * @param stream An OutputStreamObject representing an existing file to use | |
538 * when writing trace data. | |
539 * @param nodeid The node identifier/number of the node on which to enable | |
540 * ascii tracing | |
541 * @param deviceid The device identifier/index of the device on which to enabl e | |
542 * ascii tracing | |
543 */ | |
544 void EnableAscii (Ptr<OutputStreamObject> stream, uint32_t nodeid, uint32_t de viceid); | |
545 | |
546 private: | |
547 /** | |
548 * @internal Avoid code duplication. | |
549 */ | |
550 void EnableAsciiImpl (Ptr<OutputStreamObject> stream, std::string prefix, uint 32_t nodeid, uint32_t deviceid); | |
551 | |
552 /** | |
553 * @internal Avoid code duplication. | |
554 */ | |
555 void EnableAsciiImpl (Ptr<OutputStreamObject> stream, std::string prefix, Node Container n); | |
556 | |
557 /** | |
558 * @internal Avoid code duplication. | |
559 */ | |
560 void EnableAsciiImpl (Ptr<OutputStreamObject> stream, std::string prefix, NetD eviceContainer d); | |
561 | |
562 /** | |
563 * @internal Avoid code duplication. | |
564 */ | |
565 void EnableAsciiImpl (Ptr<OutputStreamObject> stream, std::string prefix, std: :string ndName); | |
566 | |
567 /** | |
568 * @internal Avoid code duplication. | |
569 */ | |
570 void EnableAsciiImpl (Ptr<OutputStreamObject> stream, std::string prefix, Ptr< NetDevice> nd); | |
571 | |
572 }; | |
573 | |
574 /** | |
575 * \brief Base class providing common user-level pcap operations for helpers | |
576 * representing IPv4 protocols . | |
577 */ | |
578 class PcapHelperForIpv4 | |
579 { | |
580 public: | |
581 /** | |
582 * @brief Enable pcap output the indicated Ipv4 and interface pair. | |
583 * @internal | |
584 * | |
585 * @param prefix Filename prefix to use for pcap files. | |
586 * @param ipv4 Ptr<Ipv4> on which you want to enable tracing. | |
587 * @param interface Interface on ipv4 on which you want to enable tracing. | |
588 */ | |
589 virtual void EnablePcapIpv4Internal (std::string prefix, Ptr<Ipv4> ipv4, uint3 2_t interface) = 0; | |
590 | |
591 /** | |
592 * @brief Enable pcap output the indicated Ipv4 and interface pair. | |
593 * | |
594 * @param prefix Filename prefix to use for pcap files. | |
595 * @param ipv4 Ptr<Ipv4> on which you want to enable tracing. | |
596 * @param interface Interface on ipv4 on which you want to enable tracing. | |
597 */ | |
598 void EnablePcapIpv4 (std::string prefix, Ptr<Ipv4> ipv4, uint32_t interface); | |
599 | |
600 /** | |
601 * @brief Enable pcap output the indicated Ipv4 and interface pair using a | |
602 * Ptr<Ipv4> previously named using the ns-3 object name service. | |
603 * | |
604 * @param filename filename prefix to use for pcap files. | |
605 * @param ipv4Name Name of the Ptr<Ipv4> on which you want to enable tracing. | |
606 * @param interface Interface on ipv4 on which you want to enable tracing. | |
607 */ | |
608 void EnablePcapIpv4 (std::string prefix, std::string ipv4Name, uint32_t interf ace); | |
609 | |
610 /** | |
611 * @brief Enable pcap output on each Ipv4 and interface pair in the container. | |
612 * | |
613 * @param prefix Filename prefix to use for pcap files. | |
614 * @param c Ipv4InterfaceContainer of Ipv4 and interface pairs | |
615 */ | |
616 void EnablePcapIpv4 (std::string prefix, Ipv4InterfaceContainer c); | |
617 | |
618 /** | |
619 * @brief Enable pcap output on all Ipv4 and interface pairs existing in the | |
620 * nodes provided in the container. | |
621 * | |
622 * \param prefix Filename prefix to use for pcap files. | |
623 * \param n container of nodes. | |
624 */ | |
625 void EnablePcapIpv4 (std::string prefix, NodeContainer n); | |
626 | |
627 /** | |
628 * @brief Enable pcap output on the Ipv4 and interface pair specified by a· | |
629 * global node-id (of a previously created node) and interface. Since there | |
630 * can be only one Ipv4 aggregated to a node, the node-id unambiguously· | |
631 * determines the Ipv4. | |
632 * | |
633 * @param prefix Filename prefix to use for pcap files. | |
634 */ | |
635 void EnablePcapIpv4 (std::string prefix, uint32_t nodeid, uint32_t interface); | |
636 | |
637 /** | |
638 * @brief Enable pcap output on all Ipv4 and interface pairs existing in the· | |
639 * set of all nodes created in the simulation. | |
640 * | |
641 * @param prefix Filename prefix to use for pcap files. | |
642 */ | |
643 void EnablePcapIpv4All (std::string prefix); | |
644 | |
645 }; | |
646 | |
647 /** | |
648 * @brief Base class providing common pcap and ascii trace operations for· | |
649 * helpers working with Ipv4 interfaces. | |
650 * | |
651 * It would be nice to make this class completely independent of the pcap | |
652 * trace helper for Ipv4, but pybindgen doesn't support multiple inheritance | |
653 * no matter how well behaved, so even mixins are out of the question. Because | |
654 * of this, we have a hierarchy of tracing functionality that protocol helpers | |
655 * can add. If your helper inherits from PcapHelperForIpv4, you get pcap | |
656 * tracing. If your helper inherits from PcapAndAsciiHelperForIpv4, you | |
657 * get both ascii and pcap tracing. | |
658 */ | |
659 class PcapAndAsciiHelperForIpv4 : public PcapHelperForIpv4 | |
660 { | |
661 public: | |
662 /** | |
663 * @brief Enable ascii trace output on the indicated Ipv4 and interface pair. | |
664 * @internal | |
665 * | |
666 * The implementation is expected to use a provided Ptr<OutputStreamObject> | |
667 * if it is non-null. If the OutputStreamObject is null, the implementation | |
668 * is expected to use a provided prefix to construct a new file name for | |
669 * each net device using the rules described in the class overview. | |
670 * | |
671 * If the prefix is provided, there will be one file per Ipv4 and interface pa ir | |
672 * created. In this case, adding a trace context to the file would be pointle ss, | |
673 * so the helper implementation is expected to TraceConnectWithoutContext. | |
674 * | |
675 * If the output stream object is provided, there may be many different Ipv4· | |
676 * and interface pairs writing to a single file. In this case, the trace· | |
677 * context could be important, so the helper implementation is expected to· | |
678 * TraceConnect. | |
679 * | |
680 * @param stream An OutputStreamObject representing an existing file to use | |
681 * when writing trace data. | |
682 * @param prefix Filename prefix to use for ascii trace files. | |
683 * @param ipv4 Ptr<Ipv4> on which you want to enable tracing. | |
684 * @param interface The interface on which you want to enable tracing. | |
685 */ | |
686 virtual void EnableAsciiIpv4Internal (Ptr<OutputStreamObject> stream, std::str ing prefix,· | |
687 Ptr<Ipv4> ipv4, uint32_t interface) = 0; | |
688 | |
689 /** | |
690 * @brief Enable ascii trace output on the indicated Ipv4 and interface pair. | |
691 * | |
692 * @param prefix Filename prefix to use for ascii files. | |
693 * @param ipv4 Ptr<Ipv4> on which you want to enable tracing. | |
694 * @param interface The interface on which you want to enable tracing. | |
695 */ | |
696 void EnableAsciiIpv4 (std::string prefix, Ptr<Ipv4> ipv4, uint32_t interface); | |
697 | |
698 /** | |
699 * @brief Enable ascii trace output on the indicated Ipv4 and interface pair. | |
700 * | |
701 * @param stream An OutputStreamObject representing an existing file to use | |
702 * when writing trace data. | |
703 * @param ipv4 Ptr<Ipv4> on which you want to enable tracing. | |
704 * @param interface The interface on which you want to enable tracing. | |
705 */ | |
706 void EnableAsciiIpv4 (Ptr<OutputStreamObject> stream, Ptr<Ipv4> ipv4, uint32_t interface); | |
707 | |
708 /** | |
709 * @brief Enable ascii trace output the indicated Ipv4 and interface pair | |
710 * using an Ipv4 previously named using the ns-3 object name service. | |
711 * | |
712 * @param filename filename prefix to use for ascii files. | |
713 * @param ipv4Name The name of the Ipv4 on which you want to enable tracing. | |
714 * @param interface The interface on which you want to enable tracing. | |
715 */ | |
716 void EnableAsciiIpv4 (std::string prefix, std::string ipv4Name, uint32_t inter face); | |
717 | |
718 /** | |
719 * @brief Enable ascii trace output the indicated net device using a device· | |
720 * previously named using the ns-3 object name service. | |
721 * | |
722 * @param stream An OutputStreamObject representing an existing file to use | |
723 * when writing trace data. | |
724 * @param ipv4Name The name of the Ipv4 on which you want to enable tracing. | |
725 * @param interface The interface on which you want to enable tracing. | |
726 */ | |
727 void EnableAsciiIpv4 (Ptr<OutputStreamObject> stream, std::string ipv4Name, ui nt32_t interface); | |
728 | |
729 /** | |
730 * @brief Enable ascii trace output on each Ipv4 and interface pair in the· | |
731 * container | |
732 * | |
733 * @param prefix Filename prefix to use for ascii files. | |
734 * @param c Ipv4InterfaceContainer of Ipv4 and interface pairs on which to· | |
735 * enable tracing. | |
736 */ | |
737 void EnableAsciiIpv4 (std::string prefix, Ipv4InterfaceContainer c); | |
738 | |
739 /** | |
740 * @brief Enable ascii trace output on each device in the container which is | |
741 * of the appropriate type. | |
742 * | |
743 * @param stream An OutputStreamObject representing an existing file to use | |
744 * when writing trace data. | |
745 * @param c Ipv4InterfaceContainer of Ipv4 and interface pairs on which to· | |
746 * enable tracing. | |
747 */ | |
748 void EnableAsciiIpv4 (Ptr<OutputStreamObject> stream, Ipv4InterfaceContainer c ); | |
749 | |
750 /** | |
751 * @brief Enable ascii trace output on all Ipv4 and interface pairs existing | |
752 * in the nodes provided in the container. | |
753 * | |
754 * \param prefix Filename prefix to use for ascii files. | |
755 * \param n container of nodes. | |
756 */ | |
757 void EnableAsciiIpv4 (std::string prefix, NodeContainer n); | |
758 | |
759 /** | |
760 * @brief Enable ascii trace output on all Ipv4 and interface pairs existing | |
761 * in the nodes provided in the container. | |
762 * | |
763 * @param stream An OutputStreamObject representing an existing file to use | |
764 * when writing trace data. | |
765 * \param n container of nodes. | |
766 */ | |
767 void EnableAsciiIpv4 (Ptr<OutputStreamObject> stream, NodeContainer n); | |
768 | |
769 /** | |
770 * @brief Enable ascii trace output on all Ipv4 and interface pairs existing | |
771 * in the set of all nodes created in the simulation. | |
772 * | |
773 * @param prefix Filename prefix to use for ascii files. | |
774 */ | |
775 void EnableAsciiIpv4All (std::string prefix); | |
776 | |
777 /** | |
778 * @brief Enable ascii trace output on each device (which is of the | |
779 * appropriate type) in the set of all nodes created in the simulation. | |
780 * | |
781 * @param stream An OutputStreamObject representing an existing file to use | |
782 * when writing trace data. | |
783 */ | |
784 void EnableAsciiIpv4All (Ptr<OutputStreamObject> stream); | |
785 | |
786 /** | |
787 * @brief Enable pcap output on the Ipv4 and interface pair specified by a· | |
788 * global node-id (of a previously created node) and interface. Since there | |
789 * can be only one Ipv4 aggregated to a node, the node-id unambiguously· | |
790 * determines the Ipv4. | |
791 * | |
792 * @param prefix Filename prefix to use when creating ascii trace files | |
793 * @param nodeid The node identifier/number of the node on which to enable | |
794 * ascii tracing | |
795 * @param interface The device identifier/index of the device on which to enab le | |
796 * ascii tracing | |
797 */ | |
798 void EnableAsciiIpv4 (std::string prefix, uint32_t nodeid, uint32_t deviceid); | |
799 | |
800 /** | |
801 * @brief Enable pcap output on the Ipv4 and interface pair specified by a· | |
802 * global node-id (of a previously created node) and interface. Since there | |
803 * can be only one Ipv4 aggregated to a node, the node-id unambiguously· | |
804 * determines the Ipv4. | |
805 * | |
806 * @param stream An OutputStreamObject representing an existing file to use | |
807 * when writing trace data. | |
808 * @param nodeid The node identifier/number of the node on which to enable | |
809 * ascii tracing | |
810 * @param interface The interface on which you want to enable tracing. | |
811 */ | |
812 void EnableAsciiIpv4 (Ptr<OutputStreamObject> stream, uint32_t nodeid, uint32_ t interface); | |
813 | |
814 private: | |
815 /** | |
816 * @internal Avoid code duplication. | |
817 */ | |
818 void EnableAsciiIpv4Impl (Ptr<OutputStreamObject> stream, std::string prefix, uint32_t nodeid, uint32_t interface); | |
819 | |
820 /** | |
821 * @internal Avoid code duplication. | |
822 */ | |
823 void EnableAsciiIpv4Impl (Ptr<OutputStreamObject> stream, std::string prefix, NodeContainer n); | |
824 | |
825 /** | |
826 * @internal Avoid code duplication. | |
827 */ | |
828 void EnableAsciiIpv4Impl (Ptr<OutputStreamObject> stream, std::string prefix, Ipv4InterfaceContainer c); | |
829 | |
830 /** | |
831 * @internal Avoid code duplication. | |
832 */ | |
833 void EnableAsciiIpv4Impl (Ptr<OutputStreamObject> stream, std::string prefix, std::string ipv4Name, uint32_t interface); | |
834 | |
835 /** | |
836 * @internal Avoid code duplication. | |
837 */ | |
838 void EnableAsciiIpv4Impl (Ptr<OutputStreamObject> stream, std::string prefix, Ptr<Ipv4> ipv4, uint32_t interface); | |
839 | |
840 }; | |
841 | |
842 /** | |
843 * \brief Base class providing common user-level ascii and pcap tracing | |
844 * for Ipv4 protocols plus pcap tracing for IPv6 protocols . | |
845 * | |
846 * It would be nice to make this class completely independent of the trace· | |
847 * helpers for Ipv4, but pybindgen doesn't support multiple inheritance | |
848 * no matter how well behaved, so even mixins are out of the question. Because | |
849 * of this, we have a hierarchy of tracing functionality that protocols can | |
850 * add. If your protocol helper inherits from PcapHelperForIpv4, you get pcap | |
851 * tracing for Ipv4 protocols. If your protocol helper inherits from· | |
852 * PcapAndAsciiHelperForIpv4, you get both ascii and pcap tracing for Ipv4 | |
853 * protocols. If you inherit from PcapAndAsciiHelperForIpv4AndPcapHelperForIpv6 | |
854 * you get both ascii and pcap tracing for Ipv4 and pcap tracing for Ipv6. | |
855 */ | |
856 class PcapAndAsciiHelperForIpv4AndPcapHelperForIpv6 : public PcapAndAsciiHelperF orIpv4 | |
857 { | |
858 public: | |
859 /** | |
860 * @brief Enable pcap output the indicated Ipv6 and interface pair. | |
861 * @internal | |
862 * | |
863 * @param prefix Filename prefix to use for pcap files. | |
864 * @param ipv6 Ptr<Ipv6> on which you want to enable tracing. | |
865 * @param interface Interface on ipv6 on which you want to enable tracing. | |
866 */ | |
867 virtual void EnablePcapIpv6Internal (std::string prefix, Ptr<Ipv6> ipv6, uint3 2_t interface) = 0; | |
868 | |
869 /** | |
870 * @brief Enable pcap output the indicated Ipv6 and interface pair. | |
871 * | |
872 * @param prefix Filename prefix to use for pcap files. | |
873 * @param ipv6 Ptr<Ipv6> on which you want to enable tracing. | |
874 * @param interface Interface on ipv6 on which you want to enable tracing. | |
875 */ | |
876 void EnablePcapIpv6 (std::string prefix, Ptr<Ipv6> ipv6, uint32_t interface); | |
877 | |
878 /** | |
879 * @brief Enable pcap output the indicated Ipv6 and interface pair using a | |
880 * Ptr<Ipv6> previously named using the ns-3 object name service. | |
881 * | |
882 * @param filename filename prefix to use for pcap files. | |
883 * @param ipv6Name Name of the Ptr<Ipv6> on which you want to enable tracing. | |
884 * @param interface Interface on ipv6 on which you want to enable tracing. | |
885 */ | |
886 void EnablePcapIpv6 (std::string prefix, std::string ipv6Name, uint32_t interf ace); | |
887 | |
888 /** | |
889 * @brief Enable pcap output on each Ipv6 and interface pair in the container. | |
890 * | |
891 * @param prefix Filename prefix to use for pcap files. | |
892 * @param c Ipv6InterfaceContainer of Ipv6 and interface pairs | |
893 */ | |
894 void EnablePcapIpv6 (std::string prefix, Ipv6InterfaceContainer c); | |
895 | |
896 /** | |
897 * @brief Enable pcap output on all Ipv6 and interface pairs existing in the | |
898 * nodes provided in the container. | |
899 * | |
900 * \param prefix Filename prefix to use for pcap files. | |
901 * \param n container of nodes. | |
902 */ | |
903 void EnablePcapIpv6 (std::string prefix, NodeContainer n); | |
904 | |
905 /** | |
906 * @brief Enable pcap output on the Ipv6 and interface pair specified by a· | |
907 * global node-id (of a previously created node) and interface. Since there | |
908 * can be only one Ipv6 aggregated to a node, the node-id unambiguously· | |
909 * determines the Ipv6. | |
910 * | |
911 * @param prefix Filename prefix to use for pcap files. | |
912 */ | |
913 void EnablePcapIpv6 (std::string prefix, uint32_t nodeid, uint32_t interface); | |
914 | |
915 /** | |
916 * @brief Enable pcap output on all Ipv6 and interface pairs existing in the· | |
917 * set of all nodes created in the simulation. | |
918 * | |
919 * @param prefix Filename prefix to use for pcap files. | |
920 */ | |
921 void EnablePcapIpv6All (std::string prefix); | |
922 }; | |
923 | |
924 /** | |
925 * @brief Base class providing common ascii trace operations for helpers | |
926 * working with Ipv4 and Ipv6 interfaces. | |
927 * | |
928 * It would be nice to make this class completely independent of the trace· | |
929 * helpers for Ipv4, and the pcap helper for Ipv6, but pybindgen doesn't support | |
930 * multiple inheritance no matter how well behaved, so even mixins are out of· | |
931 * the question. Because of this, we have a hierarchy of tracing functionality | |
932 * that protocoll helpers can add. If your protocol helper inherits from· | |
933 * PcapHelperForIpv4, you get pcap tracing for Ipv4 protocols. If your protocol | |
934 * helper inherits from PcapAndAsciiHelperForIpv4, you get both ascii and pcap· | |
935 * tracing for Ipv4 protocols. If your helper inherits from· | |
936 * PcapAndAsciiHelperForIpv4AndPcapHelperForIpv6 you get both ascii and pcap· | |
937 * tracing for Ipv4 and pcap tracing for Ipv6. If your device helper inherits | |
938 * from TraceHelperForProtocol, you get the full meal deal. | |
939 */ | |
940 class TraceHelperForProtocol : public PcapAndAsciiHelperForIpv4AndPcapHelperForI pv6 | |
Tom Henderson
2010/02/03 15:05:10
I don't have a strong opinion about mixins vs lump
| |
941 { | |
942 public: | |
943 /** | |
944 * @brief Enable ascii trace output on the indicated Ipv6 and interface pair. | |
945 * @internal | |
946 * | |
947 * The implementation is expected to use a provided Ptr<OutputStreamObject> | |
948 * if it is non-null. If the OutputStreamObject is null, the implementation | |
949 * is expected to use a provided prefix to construct a new file name for | |
950 * each net device using the rules described in the class overview. | |
951 * | |
952 * If the prefix is provided, there will be one file per Ipv6 and interface pa ir | |
953 * created. In this case, adding a trace context to the file would be pointle ss, | |
954 * so the helper implementation is expected to TraceConnectWithoutContext. | |
955 * | |
956 * If the output stream object is provided, there may be many different Ipv6· | |
957 * and interface pairs writing to a single file. In this case, the trace· | |
958 * context could be important, so the helper implementation is expected to· | |
959 * TraceConnect. | |
960 * | |
961 * @param stream An OutputStreamObject representing an existing file to use | |
962 * when writing trace data. | |
963 * @param prefix Filename prefix to use for ascii trace files. | |
964 * @param ipv6 Ptr<Ipv6> on which you want to enable tracing. | |
965 * @param interface The interface on which you want to enable tracing. | |
966 */ | |
967 virtual void EnableAsciiIpv6Internal (Ptr<OutputStreamObject> stream, std::str ing prefix,· | |
968 Ptr<Ipv6> ipv6, uint32_t interface) = 0; | |
969 | |
970 /** | |
971 * @brief Enable ascii trace output on the indicated Ipv6 and interface pair. | |
972 * | |
973 * @param prefix Filename prefix to use for ascii files. | |
974 * @param ipv6 Ptr<Ipv6> on which you want to enable tracing. | |
975 * @param interface The interface on which you want to enable tracing. | |
976 */ | |
977 void EnableAsciiIpv6 (std::string prefix,· | |
978 Ptr<Ipv6> ipv6, uint32_t interface); | |
979 | |
980 /** | |
981 * @brief Enable ascii trace output on the indicated Ipv6 and interface pair. | |
982 * | |
983 * @param stream An OutputStreamObject representing an existing file to use | |
984 * when writing trace data. | |
985 * @param ipv6 Ptr<Ipv6> on which you want to enable tracing. | |
986 * @param interface The interface on which you want to enable tracing. | |
987 */ | |
988 void EnableAsciiIpv6 (Ptr<OutputStreamObject> stream,· | |
989 Ptr<Ipv6> ipv6, uint32_t interface); | |
990 | |
991 /** | |
992 * @brief Enable ascii trace output the indicated Ipv6 and interface pair | |
993 * using an Ipv6 previously named using the ns-3 object name service. | |
994 * | |
995 * @param filename filename prefix to use for ascii files. | |
996 * @param ipv6Name The name of the Ipv6 on which you want to enable tracing. | |
997 * @param interface The interface on which you want to enable tracing. | |
998 */ | |
999 void EnableAsciiIpv6 (std::string prefix,· | |
1000 std::string ipv6Name, uint32_t interface); | |
1001 | |
1002 /** | |
1003 * @brief Enable ascii trace output the indicated net device using a device· | |
1004 * previously named using the ns-3 object name service. | |
1005 * | |
1006 * @param stream An OutputStreamObject representing an existing file to use | |
1007 * when writing trace data. | |
1008 * @param ipv6Name The name of the Ipv6 on which you want to enable tracing. | |
1009 * @param interface The interface on which you want to enable tracing. | |
1010 */ | |
1011 void EnableAsciiIpv6 (Ptr<OutputStreamObject> stream,· | |
1012 std::string ipv6Name, uint32_t interface); | |
1013 | |
1014 /** | |
1015 * @brief Enable ascii trace output on each Ipv6 and interface pair in the· | |
1016 * container | |
1017 * | |
1018 * @param prefix Filename prefix to use for ascii files. | |
1019 * @param c Ipv6InterfaceContainer of Ipv6 and interface pairs on which to· | |
1020 * enable tracing. | |
1021 */ | |
1022 void EnableAsciiIpv6 (std::string prefix, Ipv6InterfaceContainer c); | |
1023 | |
1024 /** | |
1025 * @brief Enable ascii trace output on each device in the container which is | |
1026 * of the appropriate type. | |
1027 * | |
1028 * @param stream An OutputStreamObject representing an existing file to use | |
1029 * when writing trace data. | |
1030 * @param c Ipv6InterfaceContainer of Ipv6 and interface pairs on which to· | |
1031 * enable tracing. | |
1032 */ | |
1033 void EnableAsciiIpv6 (Ptr<OutputStreamObject> stream, Ipv6InterfaceContainer c ); | |
1034 | |
1035 /** | |
1036 * @brief Enable ascii trace output on all Ipv6 and interface pairs existing | |
1037 * in the nodes provided in the container. | |
1038 * | |
1039 * \param prefix Filename prefix to use for ascii files. | |
1040 * \param n container of nodes. | |
1041 */ | |
1042 void EnableAsciiIpv6 (std::string prefix, NodeContainer n); | |
1043 | |
1044 /** | |
1045 * @brief Enable ascii trace output on all Ipv6 and interface pairs existing | |
1046 * in the nodes provided in the container. | |
1047 * | |
1048 * @param stream An OutputStreamObject representing an existing file to use | |
1049 * when writing trace data. | |
1050 * \param n container of nodes. | |
1051 */ | |
1052 void EnableAsciiIpv6 (Ptr<OutputStreamObject> stream, NodeContainer n); | |
1053 | |
1054 /** | |
1055 * @brief Enable pcap output on the Ipv6 and interface pair specified by a· | |
1056 * global node-id (of a previously created node) and interface. Since there | |
1057 * can be only one Ipv6 aggregated to a node, the node-id unambiguously· | |
1058 * determines the Ipv6. | |
1059 * | |
1060 * @param prefix Filename prefix to use when creating ascii trace files | |
1061 * @param nodeid The node identifier/number of the node on which to enable | |
1062 * ascii tracing | |
1063 * @param interface The device identifier/index of the device on which to enab le | |
1064 * ascii tracing | |
1065 */ | |
1066 void EnableAsciiIpv6 (std::string prefix, uint32_t nodeid, uint32_t deviceid); | |
1067 | |
1068 /** | |
1069 * @brief Enable pcap output on the Ipv6 and interface pair specified by a· | |
1070 * global node-id (of a previously created node) and interface. Since there | |
1071 * can be only one Ipv6 aggregated to a node, the node-id unambiguously· | |
1072 * determines the Ipv6. | |
1073 * | |
1074 * @param stream An OutputStreamObject representing an existing file to use | |
1075 * when writing trace data. | |
1076 * @param nodeid The node identifier/number of the node on which to enable | |
1077 * ascii tracing | |
1078 * @param interface The interface on which you want to enable tracing. | |
1079 */ | |
1080 void EnableAsciiIpv6 (Ptr<OutputStreamObject> stream, uint32_t nodeid, uint32_ t interface); | |
1081 | |
1082 /** | |
1083 * @brief Enable ascii trace output on all Ipv6 and interface pairs existing | |
1084 * in the set of all nodes created in the simulation. | |
1085 * | |
1086 * @param prefix Filename prefix to use for ascii files. | |
1087 */ | |
1088 void EnableAsciiIpv6All (std::string prefix); | |
1089 | |
1090 /** | |
1091 * @brief Enable ascii trace output on each device (which is of the | |
1092 * appropriate type) in the set of all nodes created in the simulation. | |
1093 * | |
1094 * @param stream An OutputStreamObject representing an existing file to use | |
1095 * when writing trace data. | |
1096 */ | |
1097 void EnableAsciiIpv6All (Ptr<OutputStreamObject> stream); | |
1098 | |
1099 private: | |
1100 /** | |
1101 * @internal Avoid code duplication. | |
1102 */ | |
1103 void EnableAsciiIpv6Impl (Ptr<OutputStreamObject> stream, std::string prefix, uint32_t nodeid, uint32_t interface); | |
1104 | |
1105 /** | |
1106 * @internal Avoid code duplication. | |
1107 */ | |
1108 void EnableAsciiIpv6Impl (Ptr<OutputStreamObject> stream, std::string prefix, NodeContainer n); | |
1109 | |
1110 /** | |
1111 * @internal Avoid code duplication. | |
1112 */ | |
1113 void EnableAsciiIpv6Impl (Ptr<OutputStreamObject> stream, std::string prefix, Ipv6InterfaceContainer c); | |
1114 | |
1115 /** | |
1116 * @internal Avoid code duplication. | |
1117 */ | |
1118 void EnableAsciiIpv6Impl (Ptr<OutputStreamObject> stream, std::string prefix, std::string ipv6Name, uint32_t interface); | |
1119 | |
1120 /** | |
1121 * @internal Avoid code duplication. | |
1122 */ | |
1123 void EnableAsciiIpv6Impl (Ptr<OutputStreamObject> stream, std::string prefix, Ptr<Ipv6> ipv6, uint32_t interface); | |
1124 | |
1125 }; | |
1126 | |
1127 } // namespace ns3 | |
1128 | |
1129 #endif /* TRACE_HELPER_H */ | |
OLD | NEW |