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