|
28 |
#include "ns3/names.h" |
28 |
#include "ns3/names.h" |
29 |
#include "ns3/pcap-writer.h" |
29 |
#include "ns3/pcap-writer.h" |
30 |
#include "ns3/ascii-writer.h" |
30 |
#include "ns3/ascii-writer.h" |
|
|
31 |
#include "ns3/node-list.h" |
31 |
#include <string> |
32 |
#include <string> |
32 |
|
33 |
|
33 |
namespace ns3 { |
34 |
namespace ns3 { |
|
76 |
return; |
77 |
return; |
77 |
} |
78 |
} |
78 |
oss.str (""); |
79 |
oss.str (""); |
79 |
oss << filename << "-" << nodeid << "-" << deviceid << ".pcap"; |
80 |
std::string nodename=Names::FindName (NodeList::GetNode(nodeid)); |
|
|
81 |
std::string devicename=Names::FindName (NodeList::GetNode(nodeid)->GetDevice(deviceid)); |
82 |
oss << filename << "-"; |
83 |
if (nodename != "") |
84 |
{ |
85 |
oss << nodename << "-"; |
86 |
} |
87 |
else |
88 |
{ |
89 |
oss << nodeid << "-"; |
90 |
} |
91 |
if (devicename != "") |
92 |
{ |
93 |
oss << devicename; |
94 |
} |
95 |
else |
96 |
{ |
97 |
oss << deviceid; |
98 |
} |
99 |
oss << ".pcap"; |
80 |
Ptr<PcapWriter> pcap = CreateObject<PcapWriter> (); |
100 |
Ptr<PcapWriter> pcap = CreateObject<PcapWriter> (); |
81 |
pcap->Open (oss.str ()); |
101 |
pcap->Open (oss.str ()); |
82 |
pcap->WriteEthernetHeader (); |
102 |
pcap->WriteEthernetHeader (); |