author | Craig Dowell <craigdo@ee.washington.edu> |
Tue, 23 Feb 2010 10:30:38 -0800 | |
changeset 6053 | b17ea72acee9 |
parent 6052 | e146b9c9c7e7 |
child 6085 | 94b282f335d2 |
permissions | -rw-r--r-- |
3912 | 1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 |
/* |
|
3 |
* Copyright (c) 2008 INRIA |
|
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 |
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
|
19 |
*/ |
|
6013 | 20 |
|
6028
96fb92f73f3d
merge trace helpers, rescan
Craig Dowell <craigdo@ee.washington.edu>
parents:
6013
diff
changeset
|
21 |
#include "trace-helper.h" |
4000
07bf8da834e0
bug 435: file names are not consistent
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3912
diff
changeset
|
22 |
#include "yans-wifi-helper.h" |
3912 | 23 |
#include "ns3/error-rate-model.h" |
24 |
#include "ns3/propagation-loss-model.h" |
|
25 |
#include "ns3/propagation-delay-model.h" |
|
26 |
#include "ns3/yans-wifi-channel.h" |
|
27 |
#include "ns3/yans-wifi-phy.h" |
|
28 |
#include "ns3/wifi-net-device.h" |
|
6009
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
29 |
#include "ns3/radiotap-header.h" |
6052
e146b9c9c7e7
PcapFileObject to PcapFileWrapper
Craig Dowell <craigdo@ee.washington.edu>
parents:
6049
diff
changeset
|
30 |
#include "ns3/pcap-file-wrapper.h" |
3912 | 31 |
#include "ns3/simulator.h" |
32 |
#include "ns3/config.h" |
|
4147
5d8530130930
rename object-names.{cc,h} to names.{cc,h} per convention
Craig Dowell <craigdo@ee.washington.edu>
parents:
4140
diff
changeset
|
33 |
#include "ns3/names.h" |
6009
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
34 |
#include "ns3/abort.h" |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
35 |
#include "ns3/log.h" |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
36 |
|
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
37 |
NS_LOG_COMPONENT_DEFINE ("YansWifiHelper"); |
3912 | 38 |
|
39 |
namespace ns3 { |
|
40 |
||
6013 | 41 |
static void |
42 |
AsciiPhyTransmitSinkWithContext ( |
|
6053
b17ea72acee9
OutputStreamKeeper to OutputStreamWrapper
Craig Dowell <craigdo@ee.washington.edu>
parents:
6052
diff
changeset
|
43 |
Ptr<OutputStreamWrapper> stream, |
6013 | 44 |
std::string context, |
45 |
Ptr<const Packet> p, |
|
46 |
WifiMode mode, |
|
47 |
WifiPreamble preamble, |
|
48 |
uint8_t txLevel) |
|
3912 | 49 |
{ |
6013 | 50 |
NS_LOG_FUNCTION (stream << context << p << mode << preamble << txLevel); |
51 |
*stream->GetStream () << "t " << Simulator::Now ().GetSeconds () << " " << context << " " << *p << std::endl; |
|
52 |
} |
|
53 |
||
54 |
static void |
|
55 |
AsciiPhyTransmitSinkWithoutContext ( |
|
6053
b17ea72acee9
OutputStreamKeeper to OutputStreamWrapper
Craig Dowell <craigdo@ee.washington.edu>
parents:
6052
diff
changeset
|
56 |
Ptr<OutputStreamWrapper> stream, |
6013 | 57 |
Ptr<const Packet> p, |
58 |
WifiMode mode, |
|
59 |
WifiPreamble preamble, |
|
60 |
uint8_t txLevel) |
|
61 |
{ |
|
62 |
NS_LOG_FUNCTION (stream << p << mode << preamble << txLevel); |
|
63 |
*stream->GetStream () << "t " << Simulator::Now ().GetSeconds () << " " << *p << std::endl; |
|
3912 | 64 |
} |
65 |
||
6013 | 66 |
static void |
67 |
AsciiPhyReceiveSinkWithContext ( |
|
6053
b17ea72acee9
OutputStreamKeeper to OutputStreamWrapper
Craig Dowell <craigdo@ee.washington.edu>
parents:
6052
diff
changeset
|
68 |
Ptr<OutputStreamWrapper> stream, |
6013 | 69 |
std::string context, |
70 |
Ptr<const Packet> p, |
|
71 |
double snr, |
|
72 |
WifiMode mode, |
|
73 |
enum WifiPreamble preamble) |
|
3912 | 74 |
{ |
6013 | 75 |
NS_LOG_FUNCTION (stream << context << p << snr << mode << preamble); |
76 |
*stream->GetStream () << "r " << Simulator::Now ().GetSeconds () << " " << context << " " << *p << std::endl; |
|
3912 | 77 |
} |
78 |
||
6013 | 79 |
static void |
80 |
AsciiPhyReceiveSinkWithoutContext ( |
|
6053
b17ea72acee9
OutputStreamKeeper to OutputStreamWrapper
Craig Dowell <craigdo@ee.washington.edu>
parents:
6052
diff
changeset
|
81 |
Ptr<OutputStreamWrapper> stream, |
6013 | 82 |
Ptr<const Packet> p, |
83 |
double snr, |
|
84 |
WifiMode mode, |
|
85 |
enum WifiPreamble preamble) |
|
86 |
{ |
|
87 |
NS_LOG_FUNCTION (stream << p << snr << mode << preamble); |
|
88 |
*stream->GetStream () << "r " << Simulator::Now ().GetSeconds () << " " << *p << std::endl; |
|
89 |
} |
|
3912 | 90 |
|
91 |
YansWifiChannelHelper::YansWifiChannelHelper () |
|
92 |
{} |
|
93 |
||
94 |
YansWifiChannelHelper |
|
95 |
YansWifiChannelHelper::Default (void) |
|
96 |
{ |
|
97 |
YansWifiChannelHelper helper; |
|
98 |
helper.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel"); |
|
99 |
helper.AddPropagationLoss ("ns3::LogDistancePropagationLossModel"); |
|
100 |
return helper; |
|
101 |
} |
|
102 |
||
103 |
void |
|
104 |
YansWifiChannelHelper::AddPropagationLoss (std::string type, |
|
105 |
std::string n0, const AttributeValue &v0, |
|
106 |
std::string n1, const AttributeValue &v1, |
|
107 |
std::string n2, const AttributeValue &v2, |
|
108 |
std::string n3, const AttributeValue &v3, |
|
109 |
std::string n4, const AttributeValue &v4, |
|
110 |
std::string n5, const AttributeValue &v5, |
|
111 |
std::string n6, const AttributeValue &v6, |
|
112 |
std::string n7, const AttributeValue &v7) |
|
113 |
{ |
|
114 |
ObjectFactory factory; |
|
115 |
factory.SetTypeId (type); |
|
116 |
factory.Set (n0, v0); |
|
117 |
factory.Set (n1, v1); |
|
118 |
factory.Set (n2, v2); |
|
119 |
factory.Set (n3, v3); |
|
120 |
factory.Set (n4, v4); |
|
121 |
factory.Set (n5, v5); |
|
122 |
factory.Set (n6, v6); |
|
123 |
factory.Set (n7, v7); |
|
124 |
m_propagationLoss.push_back (factory); |
|
125 |
} |
|
126 |
||
127 |
void |
|
128 |
YansWifiChannelHelper::SetPropagationDelay (std::string type, |
|
129 |
std::string n0, const AttributeValue &v0, |
|
130 |
std::string n1, const AttributeValue &v1, |
|
131 |
std::string n2, const AttributeValue &v2, |
|
132 |
std::string n3, const AttributeValue &v3, |
|
133 |
std::string n4, const AttributeValue &v4, |
|
134 |
std::string n5, const AttributeValue &v5, |
|
135 |
std::string n6, const AttributeValue &v6, |
|
136 |
std::string n7, const AttributeValue &v7) |
|
137 |
{ |
|
138 |
ObjectFactory factory; |
|
139 |
factory.SetTypeId (type); |
|
140 |
factory.Set (n0, v0); |
|
141 |
factory.Set (n1, v1); |
|
142 |
factory.Set (n2, v2); |
|
143 |
factory.Set (n3, v3); |
|
144 |
factory.Set (n4, v4); |
|
145 |
factory.Set (n5, v5); |
|
146 |
factory.Set (n6, v6); |
|
147 |
factory.Set (n7, v7); |
|
148 |
m_propagationDelay = factory; |
|
149 |
} |
|
150 |
||
151 |
Ptr<YansWifiChannel> |
|
152 |
YansWifiChannelHelper::Create (void) const |
|
153 |
{ |
|
154 |
Ptr<YansWifiChannel> channel = CreateObject<YansWifiChannel> (); |
|
155 |
Ptr<PropagationLossModel> prev = 0; |
|
156 |
for (std::vector<ObjectFactory>::const_iterator i = m_propagationLoss.begin (); i != m_propagationLoss.end (); ++i) |
|
157 |
{ |
|
158 |
Ptr<PropagationLossModel> cur = (*i).Create<PropagationLossModel> (); |
|
159 |
if (prev != 0) |
|
160 |
{ |
|
161 |
prev->SetNext (cur); |
|
162 |
} |
|
163 |
if (m_propagationLoss.begin () == i) |
|
164 |
{ |
|
165 |
channel->SetPropagationLossModel (cur); |
|
166 |
} |
|
4058
5c7df2c1cfc5
update prev even if it is null
Timo Bingmann <timo.bingmann@student.kit.edu>
parents:
4038
diff
changeset
|
167 |
prev = cur; |
3912 | 168 |
} |
169 |
Ptr<PropagationDelayModel> delay = m_propagationDelay.Create<PropagationDelayModel> (); |
|
170 |
channel->SetPropagationDelayModel (delay); |
|
171 |
return channel; |
|
172 |
} |
|
173 |
||
174 |
||
175 |
YansWifiPhyHelper::YansWifiPhyHelper () |
|
4492
3ebeb7bf3c15
added support for radiotap and prism headers
Nicola Baldo <nbaldo@cttc.es>
parents:
4264
diff
changeset
|
176 |
: m_channel (0), |
6009
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
177 |
m_pcapDlt(PcapHelper::DLT_IEEE802_11) |
3912 | 178 |
{ |
179 |
m_phy.SetTypeId ("ns3::YansWifiPhy"); |
|
180 |
} |
|
181 |
||
182 |
YansWifiPhyHelper |
|
183 |
YansWifiPhyHelper::Default (void) |
|
184 |
{ |
|
185 |
YansWifiPhyHelper helper; |
|
4038
c6f634d0fc6f
virtualize ErrorRateModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4000
diff
changeset
|
186 |
helper.SetErrorRateModel ("ns3::YansErrorRateModel"); |
3912 | 187 |
return helper; |
188 |
} |
|
189 |
||
190 |
void |
|
191 |
YansWifiPhyHelper::SetChannel (Ptr<YansWifiChannel> channel) |
|
192 |
{ |
|
193 |
m_channel = channel; |
|
194 |
} |
|
195 |
void |
|
4140
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
4058
diff
changeset
|
196 |
YansWifiPhyHelper::SetChannel (std::string channelName) |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
4058
diff
changeset
|
197 |
{ |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
4058
diff
changeset
|
198 |
Ptr<YansWifiChannel> channel = Names::Find<YansWifiChannel> (channelName); |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
4058
diff
changeset
|
199 |
m_channel = channel; |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
4058
diff
changeset
|
200 |
} |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
4058
diff
changeset
|
201 |
void |
3912 | 202 |
YansWifiPhyHelper::Set (std::string name, const AttributeValue &v) |
203 |
{ |
|
204 |
m_phy.Set (name, v); |
|
205 |
} |
|
206 |
||
207 |
void |
|
208 |
YansWifiPhyHelper::SetErrorRateModel (std::string name, |
|
209 |
std::string n0, const AttributeValue &v0, |
|
210 |
std::string n1, const AttributeValue &v1, |
|
211 |
std::string n2, const AttributeValue &v2, |
|
212 |
std::string n3, const AttributeValue &v3, |
|
213 |
std::string n4, const AttributeValue &v4, |
|
214 |
std::string n5, const AttributeValue &v5, |
|
215 |
std::string n6, const AttributeValue &v6, |
|
216 |
std::string n7, const AttributeValue &v7) |
|
217 |
{ |
|
218 |
m_errorRateModel = ObjectFactory (); |
|
219 |
m_errorRateModel.SetTypeId (name); |
|
220 |
m_errorRateModel.Set (n0, v0); |
|
221 |
m_errorRateModel.Set (n1, v1); |
|
222 |
m_errorRateModel.Set (n2, v2); |
|
223 |
m_errorRateModel.Set (n3, v3); |
|
224 |
m_errorRateModel.Set (n4, v4); |
|
225 |
m_errorRateModel.Set (n5, v5); |
|
226 |
m_errorRateModel.Set (n6, v6); |
|
227 |
m_errorRateModel.Set (n7, v7); |
|
228 |
} |
|
229 |
||
230 |
Ptr<WifiPhy> |
|
231 |
YansWifiPhyHelper::Create (Ptr<Node> node, Ptr<WifiNetDevice> device) const |
|
232 |
{ |
|
233 |
Ptr<YansWifiPhy> phy = m_phy.Create<YansWifiPhy> (); |
|
234 |
Ptr<ErrorRateModel> error = m_errorRateModel.Create<ErrorRateModel> (); |
|
235 |
phy->SetErrorRateModel (error); |
|
236 |
phy->SetChannel (m_channel); |
|
237 |
phy->SetMobility (node); |
|
238 |
phy->SetDevice (device); |
|
239 |
return phy; |
|
240 |
} |
|
241 |
||
6009
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
242 |
static void |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
243 |
PcapSniffTxEvent ( |
6052
e146b9c9c7e7
PcapFileObject to PcapFileWrapper
Craig Dowell <craigdo@ee.washington.edu>
parents:
6049
diff
changeset
|
244 |
Ptr<PcapFileWrapper> file, |
6009
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
245 |
Ptr<const Packet> packet, |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
246 |
uint16_t channelFreqMhz, |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
247 |
uint16_t channelNumber, |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
248 |
uint32_t rate, |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
249 |
bool isShortPreamble) |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
250 |
{ |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
251 |
uint32_t dlt = file->GetDataLinkType (); |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
252 |
|
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
253 |
switch (dlt) |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
254 |
{ |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
255 |
case PcapHelper::DLT_IEEE802_11: |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
256 |
file->Write (Simulator::Now (), packet); |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
257 |
return; |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
258 |
case PcapHelper::DLT_PRISM_HEADER: |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
259 |
{ |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
260 |
NS_FATAL_ERROR ("PcapSniffTxEvent(): DLT_PRISM_HEADER not implemented"); |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
261 |
return; |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
262 |
} |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
263 |
case PcapHelper::DLT_IEEE802_11_RADIO: |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
264 |
{ |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
265 |
Ptr<Packet> p = packet->Copy (); |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
266 |
RadiotapHeader header; |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
267 |
header.SetTsft (Simulator::Now ().GetMicroSeconds ()); |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
268 |
|
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
269 |
if (isShortPreamble) |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
270 |
{ |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
271 |
header.SetFrameFlags (RadiotapHeader::FRAME_FLAG_SHORT_PREAMBLE); |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
272 |
} |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
273 |
else |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
274 |
{ |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
275 |
header.SetFrameFlags (RadiotapHeader::FRAME_FLAG_NONE); |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
276 |
} |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
277 |
|
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
278 |
header.SetRate (rate); |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
279 |
|
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
280 |
if (channelFreqMhz < 2500) |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
281 |
{ |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
282 |
header.SetChannelFrequencyAndFlags (channelFreqMhz, |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
283 |
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ | RadiotapHeader::CHANNEL_FLAG_CCK); |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
284 |
} |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
285 |
else |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
286 |
{ |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
287 |
header.SetChannelFrequencyAndFlags (channelFreqMhz, |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
288 |
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ | RadiotapHeader::CHANNEL_FLAG_OFDM); |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
289 |
} |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
290 |
|
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
291 |
p->AddHeader (header); |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
292 |
file->Write (Simulator::Now (), p); |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
293 |
return; |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
294 |
} |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
295 |
default: |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
296 |
NS_ABORT_MSG ("PcapSniffTxEvent(): Unexpected data link type " << dlt); |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
297 |
} |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
298 |
} |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
299 |
|
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
300 |
static void |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
301 |
PcapSniffRxEvent ( |
6052
e146b9c9c7e7
PcapFileObject to PcapFileWrapper
Craig Dowell <craigdo@ee.washington.edu>
parents:
6049
diff
changeset
|
302 |
Ptr<PcapFileWrapper> file, |
6009
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
303 |
Ptr<const Packet> packet, |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
304 |
uint16_t channelFreqMhz, |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
305 |
uint16_t channelNumber, |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
306 |
uint32_t rate, |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
307 |
bool isShortPreamble, |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
308 |
double signalDbm, |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
309 |
double noiseDbm) |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
310 |
{ |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
311 |
uint32_t dlt = file->GetDataLinkType (); |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
312 |
|
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
313 |
switch (dlt) |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
314 |
{ |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
315 |
case PcapHelper::DLT_IEEE802_11: |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
316 |
file->Write (Simulator::Now (), packet); |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
317 |
return; |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
318 |
case PcapHelper::DLT_PRISM_HEADER: |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
319 |
{ |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
320 |
NS_FATAL_ERROR ("PcapSniffRxEvent(): DLT_PRISM_HEADER not implemented"); |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
321 |
return; |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
322 |
} |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
323 |
case PcapHelper::DLT_IEEE802_11_RADIO: |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
324 |
{ |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
325 |
Ptr<Packet> p = packet->Copy (); |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
326 |
RadiotapHeader header; |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
327 |
header.SetTsft (Simulator::Now ().GetMicroSeconds ()); |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
328 |
|
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
329 |
if (isShortPreamble) |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
330 |
{ |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
331 |
header.SetFrameFlags (RadiotapHeader::FRAME_FLAG_SHORT_PREAMBLE); |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
332 |
} |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
333 |
else |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
334 |
{ |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
335 |
header.SetFrameFlags (RadiotapHeader::FRAME_FLAG_NONE); |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
336 |
} |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
337 |
|
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
338 |
header.SetRate (rate); |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
339 |
|
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
340 |
if (channelFreqMhz < 2500) |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
341 |
{ |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
342 |
header.SetChannelFrequencyAndFlags (channelFreqMhz, |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
343 |
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ | RadiotapHeader::CHANNEL_FLAG_CCK); |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
344 |
} |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
345 |
else |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
346 |
{ |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
347 |
header.SetChannelFrequencyAndFlags (channelFreqMhz, |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
348 |
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ | RadiotapHeader::CHANNEL_FLAG_OFDM); |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
349 |
} |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
350 |
|
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
351 |
header.SetAntennaSignalPower (signalDbm); |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
352 |
header.SetAntennaNoisePower (noiseDbm); |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
353 |
|
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
354 |
p->AddHeader (header); |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
355 |
file->Write (Simulator::Now (), p); |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
356 |
return; |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
357 |
} |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
358 |
default: |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
359 |
NS_ABORT_MSG ("PcapSniffRxEvent(): Unexpected data link type " << dlt); |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
360 |
} |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
361 |
} |
4492
3ebeb7bf3c15
added support for radiotap and prism headers
Nicola Baldo <nbaldo@cttc.es>
parents:
4264
diff
changeset
|
362 |
|
3ebeb7bf3c15
added support for radiotap and prism headers
Nicola Baldo <nbaldo@cttc.es>
parents:
4264
diff
changeset
|
363 |
void |
6041 | 364 |
YansWifiPhyHelper::SetPcapDataLinkType (enum SupportedPcapDataLinkTypes dlt) |
4492
3ebeb7bf3c15
added support for radiotap and prism headers
Nicola Baldo <nbaldo@cttc.es>
parents:
4264
diff
changeset
|
365 |
{ |
6041 | 366 |
switch (dlt) |
3912 | 367 |
{ |
6041 | 368 |
case DLT_IEEE802_11: |
6009
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
369 |
m_pcapDlt = PcapHelper::DLT_IEEE802_11; |
3912 | 370 |
return; |
6041 | 371 |
case DLT_PRISM_HEADER: |
6009
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
372 |
m_pcapDlt = PcapHelper::DLT_PRISM_HEADER; |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
373 |
return; |
6041 | 374 |
case DLT_IEEE802_11_RADIO: |
6009
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
375 |
m_pcapDlt = PcapHelper::DLT_IEEE802_11_RADIO; |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
376 |
return; |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
377 |
default: |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
378 |
NS_ABORT_MSG ("YansWifiPhyHelper::SetPcapFormat(): Unexpected format"); |
3912 | 379 |
} |
380 |
} |
|
4264
9d2e96c4e6e4
Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4263
diff
changeset
|
381 |
|
9d2e96c4e6e4
Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4263
diff
changeset
|
382 |
void |
6009
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
383 |
YansWifiPhyHelper::EnablePcapInternal (std::string prefix, Ptr<NetDevice> nd, bool promiscuous) |
4264
9d2e96c4e6e4
Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents:
4263
diff
changeset
|
384 |
{ |
6009
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
385 |
// |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
386 |
// All of the Pcap enable functions vector through here including the ones |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
387 |
// that are wandering through all of devices on perhaps all of the nodes in |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
388 |
// the system. We can only deal with devices of type WifiNetDevice. |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
389 |
// |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
390 |
Ptr<WifiNetDevice> device = nd->GetObject<WifiNetDevice> (); |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
391 |
if (device == 0) |
3912 | 392 |
{ |
6009
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
393 |
NS_LOG_INFO ("YansWifiHelper::EnablePcapInternal(): Device " << &device << " not of type ns3::WifiNetDevice"); |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
394 |
return; |
3912 | 395 |
} |
6009
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
396 |
|
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
397 |
Ptr<WifiPhy> phy = device->GetPhy (); |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
398 |
NS_ABORT_MSG_IF (phy == 0, "YansWifiPhyHelper::EnablePcapInternal(): Phy layer in WifiNetDevice must be set"); |
3912 | 399 |
|
6009
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
400 |
PcapHelper pcapHelper; |
6013 | 401 |
std::string filename = pcapHelper.GetFilenameFromDevice (prefix, device); |
6009
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
402 |
|
6052
e146b9c9c7e7
PcapFileObject to PcapFileWrapper
Craig Dowell <craigdo@ee.washington.edu>
parents:
6049
diff
changeset
|
403 |
Ptr<PcapFileWrapper> file = pcapHelper.CreateFile (filename, "w", m_pcapDlt); |
6009
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
404 |
|
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
405 |
phy->TraceConnectWithoutContext ("PromiscSnifferTx", MakeBoundCallback (&PcapSniffTxEvent, file)); |
e1b696a1ed28
redo pcap tracing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4715
diff
changeset
|
406 |
phy->TraceConnectWithoutContext ("PromiscSnifferRx", MakeBoundCallback (&PcapSniffRxEvent, file)); |
3912 | 407 |
} |
408 |
||
409 |
void |
|
6053
b17ea72acee9
OutputStreamKeeper to OutputStreamWrapper
Craig Dowell <craigdo@ee.washington.edu>
parents:
6052
diff
changeset
|
410 |
YansWifiPhyHelper::EnableAsciiInternal (Ptr<OutputStreamWrapper> stream, std::string prefix, Ptr<NetDevice> nd) |
3912 | 411 |
{ |
6013 | 412 |
// |
413 |
// All of the ascii enable functions vector through here including the ones |
|
414 |
// that are wandering through all of devices on perhaps all of the nodes in |
|
415 |
// the system. We can only deal with devices of type CsmaNetDevice. |
|
416 |
// |
|
417 |
Ptr<WifiNetDevice> device = nd->GetObject<WifiNetDevice> (); |
|
418 |
if (device == 0) |
|
419 |
{ |
|
420 |
NS_LOG_INFO ("YansWifiHelper::EnableAsciiInternal(): Device " << device << " not of type ns3::WifiNetDevice"); |
|
421 |
return; |
|
422 |
} |
|
423 |
||
424 |
// |
|
425 |
// Our trace sinks are going to use packet printing, so we have to make sure |
|
426 |
// that is turned on. |
|
427 |
// |
|
3912 | 428 |
Packet::EnablePrinting (); |
6013 | 429 |
|
430 |
uint32_t nodeid = nd->GetNode ()->GetId (); |
|
431 |
uint32_t deviceid = nd->GetIfIndex (); |
|
3912 | 432 |
std::ostringstream oss; |
6013 | 433 |
|
434 |
// |
|
6053
b17ea72acee9
OutputStreamKeeper to OutputStreamWrapper
Craig Dowell <craigdo@ee.washington.edu>
parents:
6052
diff
changeset
|
435 |
// If we are not provided an OutputStreamWrapper, we are expected to create |
6013 | 436 |
// one using the usual trace filename conventions and write our traces |
437 |
// without a context since there will be one file per context and therefore |
|
438 |
// the context would be redundant. |
|
439 |
// |
|
440 |
if (stream == 0) |
|
441 |
{ |
|
442 |
// |
|
443 |
// Set up an output stream object to deal with private ofstream copy |
|
444 |
// constructor and lifetime issues. Let the helper decide the actual |
|
445 |
// name of the file given the prefix. |
|
446 |
// |
|
447 |
AsciiTraceHelper asciiTraceHelper; |
|
448 |
std::string filename = asciiTraceHelper.GetFilenameFromDevice (prefix, device); |
|
6053
b17ea72acee9
OutputStreamKeeper to OutputStreamWrapper
Craig Dowell <craigdo@ee.washington.edu>
parents:
6052
diff
changeset
|
449 |
Ptr<OutputStreamWrapper> theStream = asciiTraceHelper.CreateFileStream (filename, "w"); |
6013 | 450 |
|
451 |
// |
|
452 |
// We could go poking through the phy and the state looking for the |
|
453 |
// correct trace source, but we can let Config deal with that with |
|
454 |
// some search cost. Since this is presumably happening at topology |
|
455 |
// creation time, it doesn't seem much of a price to pay. |
|
456 |
// |
|
457 |
oss.str (""); |
|
458 |
oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WifiNetDevice/Phy/State/RxOk"; |
|
459 |
Config::ConnectWithoutContext (oss.str (), MakeBoundCallback (&AsciiPhyReceiveSinkWithoutContext, stream)); |
|
460 |
||
461 |
oss.str (""); |
|
462 |
oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WifiNetDevice/Phy/State/Tx"; |
|
463 |
Config::ConnectWithoutContext (oss.str (), MakeBoundCallback (&AsciiPhyTransmitSinkWithoutContext, stream)); |
|
464 |
||
465 |
return; |
|
466 |
} |
|
467 |
||
468 |
// |
|
6053
b17ea72acee9
OutputStreamKeeper to OutputStreamWrapper
Craig Dowell <craigdo@ee.washington.edu>
parents:
6052
diff
changeset
|
469 |
// If we are provided an OutputStreamWrapper, we are expected to use it, and |
6013 | 470 |
// to provide a context. We are free to come up with our own context if we |
471 |
// want, and use the AsciiTraceHelper Hook*WithContext functions, but for |
|
472 |
// compatibility and simplicity, we just use Config::Connect and let it deal |
|
473 |
// with coming up with a context. |
|
474 |
// |
|
475 |
oss.str (""); |
|
3912 | 476 |
oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WifiNetDevice/Phy/State/RxOk"; |
6013 | 477 |
Config::Connect (oss.str (), MakeBoundCallback (&AsciiPhyReceiveSinkWithContext, stream)); |
478 |
||
3912 | 479 |
oss.str (""); |
480 |
oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WifiNetDevice/Phy/State/Tx"; |
|
6013 | 481 |
Config::Connect (oss.str (), MakeBoundCallback (&AsciiPhyTransmitSinkWithContext, stream)); |
3912 | 482 |
} |
483 |
||
484 |
} // namespace ns3 |