author | Craig Dowell <craigdo@ee.washington.edu> |
Sat, 28 Feb 2009 16:25:24 -0800 | |
changeset 4263 | fec2f830d015 |
parent 4147 | 5d8530130930 |
child 4264 | 9d2e96c4e6e4 |
permissions | -rw-r--r-- |
2833
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2799
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2799
diff
changeset
|
2 |
/* |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2799
diff
changeset
|
3 |
* Copyright (c) 2008 INRIA |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2799
diff
changeset
|
4 |
* |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2799
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2799
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2799
diff
changeset
|
7 |
* published by the Free Software Foundation; |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2799
diff
changeset
|
8 |
* |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2799
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2799
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2799
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2799
diff
changeset
|
12 |
* GNU General Public License for more details. |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2799
diff
changeset
|
13 |
* |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2799
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2799
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2799
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2799
diff
changeset
|
17 |
* |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2799
diff
changeset
|
18 |
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2799
diff
changeset
|
19 |
*/ |
2418
4ff45fa08781
an initial draft of helper classes. don't work yet.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
20 |
#include "csma-helper.h" |
2799
17660e306cab
Prepend ascii trace lines with action and time
Tom Henderson <tomh@tomh.org>
parents:
2789
diff
changeset
|
21 |
#include "ns3/simulator.h" |
2603
1308da4cb3bf
move helpers to their own dir.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2433
diff
changeset
|
22 |
#include "ns3/object-factory.h" |
1308da4cb3bf
move helpers to their own dir.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2433
diff
changeset
|
23 |
#include "ns3/queue.h" |
1308da4cb3bf
move helpers to their own dir.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2433
diff
changeset
|
24 |
#include "ns3/csma-net-device.h" |
1308da4cb3bf
move helpers to their own dir.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2433
diff
changeset
|
25 |
#include "ns3/csma-channel.h" |
2780
306f665014b6
add ascii and pcap tracing support to csma helper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2656
diff
changeset
|
26 |
#include "ns3/pcap-writer.h" |
306f665014b6
add ascii and pcap tracing support to csma helper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2656
diff
changeset
|
27 |
#include "ns3/config.h" |
306f665014b6
add ascii and pcap tracing support to csma helper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2656
diff
changeset
|
28 |
#include "ns3/packet.h" |
4147
5d8530130930
rename object-names.{cc,h} to names.{cc,h} per convention
Craig Dowell <craigdo@ee.washington.edu>
parents:
4140
diff
changeset
|
29 |
#include "ns3/names.h" |
2603
1308da4cb3bf
move helpers to their own dir.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2433
diff
changeset
|
30 |
#include <string> |
2418
4ff45fa08781
an initial draft of helper classes. don't work yet.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
31 |
|
4ff45fa08781
an initial draft of helper classes. don't work yet.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
32 |
namespace ns3 { |
4ff45fa08781
an initial draft of helper classes. don't work yet.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
33 |
|
4ff45fa08781
an initial draft of helper classes. don't work yet.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
34 |
CsmaHelper::CsmaHelper () |
4ff45fa08781
an initial draft of helper classes. don't work yet.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
35 |
{ |
2603
1308da4cb3bf
move helpers to their own dir.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2433
diff
changeset
|
36 |
m_queueFactory.SetTypeId ("ns3::DropTailQueue"); |
1308da4cb3bf
move helpers to their own dir.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2433
diff
changeset
|
37 |
m_deviceFactory.SetTypeId ("ns3::CsmaNetDevice"); |
1308da4cb3bf
move helpers to their own dir.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2433
diff
changeset
|
38 |
m_channelFactory.SetTypeId ("ns3::CsmaChannel"); |
2418
4ff45fa08781
an initial draft of helper classes. don't work yet.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
39 |
} |
4ff45fa08781
an initial draft of helper classes. don't work yet.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
40 |
|
4ff45fa08781
an initial draft of helper classes. don't work yet.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
41 |
void |
4ff45fa08781
an initial draft of helper classes. don't work yet.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
42 |
CsmaHelper::SetQueue (std::string type, |
3786
9f384deadb46
replace \t with 8 spaces.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3553
diff
changeset
|
43 |
std::string n1, const AttributeValue &v1, |
9f384deadb46
replace \t with 8 spaces.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3553
diff
changeset
|
44 |
std::string n2, const AttributeValue &v2, |
9f384deadb46
replace \t with 8 spaces.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3553
diff
changeset
|
45 |
std::string n3, const AttributeValue &v3, |
9f384deadb46
replace \t with 8 spaces.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3553
diff
changeset
|
46 |
std::string n4, const AttributeValue &v4) |
2418
4ff45fa08781
an initial draft of helper classes. don't work yet.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
47 |
{ |
4ff45fa08781
an initial draft of helper classes. don't work yet.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
48 |
m_queueFactory.SetTypeId (type); |
4ff45fa08781
an initial draft of helper classes. don't work yet.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
49 |
m_queueFactory.Set (n1, v1); |
4ff45fa08781
an initial draft of helper classes. don't work yet.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
50 |
m_queueFactory.Set (n2, v2); |
4ff45fa08781
an initial draft of helper classes. don't work yet.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
51 |
m_queueFactory.Set (n3, v3); |
4ff45fa08781
an initial draft of helper classes. don't work yet.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
52 |
m_queueFactory.Set (n4, v4); |
4ff45fa08781
an initial draft of helper classes. don't work yet.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
53 |
} |
4ff45fa08781
an initial draft of helper classes. don't work yet.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
54 |
|
4ff45fa08781
an initial draft of helper classes. don't work yet.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
55 |
void |
3381
3cdd9d60f7c7
bug 232, references to Parameter obsolete
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
56 |
CsmaHelper::SetDeviceAttribute (std::string n1, const AttributeValue &v1) |
2418
4ff45fa08781
an initial draft of helper classes. don't work yet.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
57 |
{ |
4ff45fa08781
an initial draft of helper classes. don't work yet.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
58 |
m_deviceFactory.Set (n1, v1); |
4ff45fa08781
an initial draft of helper classes. don't work yet.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
59 |
} |
4ff45fa08781
an initial draft of helper classes. don't work yet.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
60 |
|
4ff45fa08781
an initial draft of helper classes. don't work yet.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
61 |
void |
3381
3cdd9d60f7c7
bug 232, references to Parameter obsolete
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
62 |
CsmaHelper::SetChannelAttribute (std::string n1, const AttributeValue &v1) |
2418
4ff45fa08781
an initial draft of helper classes. don't work yet.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
63 |
{ |
2603
1308da4cb3bf
move helpers to their own dir.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2433
diff
changeset
|
64 |
m_channelFactory.Set (n1, v1); |
2418
4ff45fa08781
an initial draft of helper classes. don't work yet.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
65 |
} |
4ff45fa08781
an initial draft of helper classes. don't work yet.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
66 |
|
2780
306f665014b6
add ascii and pcap tracing support to csma helper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2656
diff
changeset
|
67 |
void |
3403
ac82ff1f6736
use NS_DEPRECATED for bug 232.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3381
diff
changeset
|
68 |
CsmaHelper::SetDeviceParameter (std::string n1, const AttributeValue &v1) |
ac82ff1f6736
use NS_DEPRECATED for bug 232.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3381
diff
changeset
|
69 |
{ |
ac82ff1f6736
use NS_DEPRECATED for bug 232.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3381
diff
changeset
|
70 |
SetDeviceAttribute (n1, v1); |
ac82ff1f6736
use NS_DEPRECATED for bug 232.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3381
diff
changeset
|
71 |
} |
4263
fec2f830d015
trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
72 |
|
3403
ac82ff1f6736
use NS_DEPRECATED for bug 232.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3381
diff
changeset
|
73 |
void |
ac82ff1f6736
use NS_DEPRECATED for bug 232.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3381
diff
changeset
|
74 |
CsmaHelper::SetChannelParameter (std::string n1, const AttributeValue &v1) |
ac82ff1f6736
use NS_DEPRECATED for bug 232.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3381
diff
changeset
|
75 |
{ |
ac82ff1f6736
use NS_DEPRECATED for bug 232.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3381
diff
changeset
|
76 |
SetChannelAttribute (n1, v1); |
ac82ff1f6736
use NS_DEPRECATED for bug 232.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3381
diff
changeset
|
77 |
} |
ac82ff1f6736
use NS_DEPRECATED for bug 232.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3381
diff
changeset
|
78 |
|
ac82ff1f6736
use NS_DEPRECATED for bug 232.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3381
diff
changeset
|
79 |
void |
2789
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
80 |
CsmaHelper::EnablePcap (std::string filename, uint32_t nodeid, uint32_t deviceid) |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
81 |
{ |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
82 |
std::ostringstream oss; |
3789
616c83eeb4b9
bug 280: trace helpers too inclusive
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3786
diff
changeset
|
83 |
oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::CsmaNetDevice/"; |
616c83eeb4b9
bug 280: trace helpers too inclusive
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3786
diff
changeset
|
84 |
Config::MatchContainer matches = Config::LookupMatches (oss.str ()); |
616c83eeb4b9
bug 280: trace helpers too inclusive
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3786
diff
changeset
|
85 |
if (matches.GetN () == 0) |
616c83eeb4b9
bug 280: trace helpers too inclusive
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3786
diff
changeset
|
86 |
{ |
616c83eeb4b9
bug 280: trace helpers too inclusive
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3786
diff
changeset
|
87 |
return; |
616c83eeb4b9
bug 280: trace helpers too inclusive
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3786
diff
changeset
|
88 |
} |
616c83eeb4b9
bug 280: trace helpers too inclusive
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3786
diff
changeset
|
89 |
oss.str (""); |
2839
b30d4ece2bbb
generate .pcap postfix for pcap filenames
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2834
diff
changeset
|
90 |
oss << filename << "-" << nodeid << "-" << deviceid << ".pcap"; |
2789
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
91 |
Ptr<PcapWriter> pcap = Create<PcapWriter> (); |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
92 |
pcap->Open (oss.str ()); |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
93 |
pcap->WriteEthernetHeader (); |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
94 |
oss.str (""); |
4263
fec2f830d015
trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
95 |
oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::CsmaNetDevice/Sniffer"; |
fec2f830d015
trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
96 |
Config::ConnectWithoutContext (oss.str (), MakeBoundCallback (&CsmaHelper::SniffEvent, pcap)); |
2789
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
97 |
} |
4263
fec2f830d015
trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
98 |
|
2789
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
99 |
void |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
100 |
CsmaHelper::EnablePcap (std::string filename, NetDeviceContainer d) |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
101 |
{ |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
102 |
for (NetDeviceContainer::Iterator i = d.Begin (); i != d.End (); ++i) |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
103 |
{ |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
104 |
Ptr<NetDevice> dev = *i; |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
105 |
EnablePcap (filename, dev->GetNode ()->GetId (), dev->GetIfIndex ()); |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
106 |
} |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
107 |
} |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
108 |
void |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
109 |
CsmaHelper::EnablePcap (std::string filename, NodeContainer n) |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
110 |
{ |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
111 |
NetDeviceContainer devs; |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
112 |
for (NodeContainer::Iterator i = n.Begin (); i != n.End (); ++i) |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
113 |
{ |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
114 |
Ptr<Node> node = *i; |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
115 |
for (uint32_t j = 0; j < node->GetNDevices (); ++j) |
3786
9f384deadb46
replace \t with 8 spaces.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3553
diff
changeset
|
116 |
{ |
9f384deadb46
replace \t with 8 spaces.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3553
diff
changeset
|
117 |
devs.Add (node->GetDevice (j)); |
9f384deadb46
replace \t with 8 spaces.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3553
diff
changeset
|
118 |
} |
2789
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
119 |
} |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
120 |
EnablePcap (filename, devs); |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
121 |
} |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
122 |
|
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
123 |
void |
2996
a83b94e277d4
EnablePcap()->EnablePcapAll(); EnableAscii()->EnableAsciiAll()
Tom Henderson <tomh@tomh.org>
parents:
2887
diff
changeset
|
124 |
CsmaHelper::EnablePcapAll (std::string filename) |
2780
306f665014b6
add ascii and pcap tracing support to csma helper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2656
diff
changeset
|
125 |
{ |
2789
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
126 |
EnablePcap (filename, NodeContainer::GetGlobal ()); |
2780
306f665014b6
add ascii and pcap tracing support to csma helper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2656
diff
changeset
|
127 |
} |
306f665014b6
add ascii and pcap tracing support to csma helper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2656
diff
changeset
|
128 |
|
306f665014b6
add ascii and pcap tracing support to csma helper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2656
diff
changeset
|
129 |
void |
2789
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
130 |
CsmaHelper::EnableAscii (std::ostream &os, uint32_t nodeid, uint32_t deviceid) |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
131 |
{ |
3553
065488d0420c
bug 279: Packets need metadata support for printing without header checking
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3403
diff
changeset
|
132 |
Packet::EnablePrinting (); |
2789
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
133 |
std::ostringstream oss; |
4263
fec2f830d015
trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
134 |
oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::CsmaNetDevice/MacRx"; |
2799
17660e306cab
Prepend ascii trace lines with action and time
Tom Henderson <tomh@tomh.org>
parents:
2789
diff
changeset
|
135 |
Config::Connect (oss.str (), MakeBoundCallback (&CsmaHelper::AsciiRxEvent, &os)); |
2789
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
136 |
oss.str (""); |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
137 |
oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::CsmaNetDevice/TxQueue/Enqueue"; |
2799
17660e306cab
Prepend ascii trace lines with action and time
Tom Henderson <tomh@tomh.org>
parents:
2789
diff
changeset
|
138 |
Config::Connect (oss.str (), MakeBoundCallback (&CsmaHelper::AsciiEnqueueEvent, &os)); |
2789
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
139 |
oss.str (""); |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
140 |
oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::CsmaNetDevice/TxQueue/Dequeue"; |
2799
17660e306cab
Prepend ascii trace lines with action and time
Tom Henderson <tomh@tomh.org>
parents:
2789
diff
changeset
|
141 |
Config::Connect (oss.str (), MakeBoundCallback (&CsmaHelper::AsciiDequeueEvent, &os)); |
17660e306cab
Prepend ascii trace lines with action and time
Tom Henderson <tomh@tomh.org>
parents:
2789
diff
changeset
|
142 |
oss.str (""); |
17660e306cab
Prepend ascii trace lines with action and time
Tom Henderson <tomh@tomh.org>
parents:
2789
diff
changeset
|
143 |
oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::CsmaNetDevice/TxQueue/Drop"; |
17660e306cab
Prepend ascii trace lines with action and time
Tom Henderson <tomh@tomh.org>
parents:
2789
diff
changeset
|
144 |
Config::Connect (oss.str (), MakeBoundCallback (&CsmaHelper::AsciiDropEvent, &os)); |
2789
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
145 |
} |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
146 |
void |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
147 |
CsmaHelper::EnableAscii (std::ostream &os, NetDeviceContainer d) |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
148 |
{ |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
149 |
for (NetDeviceContainer::Iterator i = d.Begin (); i != d.End (); ++i) |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
150 |
{ |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
151 |
Ptr<NetDevice> dev = *i; |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
152 |
EnableAscii (os, dev->GetNode ()->GetId (), dev->GetIfIndex ()); |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
153 |
} |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
154 |
} |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
155 |
void |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
156 |
CsmaHelper::EnableAscii (std::ostream &os, NodeContainer n) |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
157 |
{ |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
158 |
NetDeviceContainer devs; |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
159 |
for (NodeContainer::Iterator i = n.Begin (); i != n.End (); ++i) |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
160 |
{ |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
161 |
Ptr<Node> node = *i; |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
162 |
for (uint32_t j = 0; j < node->GetNDevices (); ++j) |
3786
9f384deadb46
replace \t with 8 spaces.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3553
diff
changeset
|
163 |
{ |
9f384deadb46
replace \t with 8 spaces.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3553
diff
changeset
|
164 |
devs.Add (node->GetDevice (j)); |
9f384deadb46
replace \t with 8 spaces.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3553
diff
changeset
|
165 |
} |
2789
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
166 |
} |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
167 |
EnableAscii (os, devs); |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
168 |
} |
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
169 |
|
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
170 |
void |
2996
a83b94e277d4
EnablePcap()->EnablePcapAll(); EnableAscii()->EnableAsciiAll()
Tom Henderson <tomh@tomh.org>
parents:
2887
diff
changeset
|
171 |
CsmaHelper::EnableAsciiAll (std::ostream &os) |
2780
306f665014b6
add ascii and pcap tracing support to csma helper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2656
diff
changeset
|
172 |
{ |
2789
47e92324cf4b
configure tracing post-topology construction, not before.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2780
diff
changeset
|
173 |
EnableAscii (os, NodeContainer::GetGlobal ()); |
2780
306f665014b6
add ascii and pcap tracing support to csma helper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2656
diff
changeset
|
174 |
} |
306f665014b6
add ascii and pcap tracing support to csma helper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2656
diff
changeset
|
175 |
|
3848
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3795
diff
changeset
|
176 |
NetDeviceContainer |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3795
diff
changeset
|
177 |
CsmaHelper::Install (Ptr<Node> node) const |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3795
diff
changeset
|
178 |
{ |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3795
diff
changeset
|
179 |
Ptr<CsmaChannel> channel = m_channelFactory.Create ()->GetObject<CsmaChannel> (); |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3795
diff
changeset
|
180 |
return Install (node, channel); |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3795
diff
changeset
|
181 |
} |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3795
diff
changeset
|
182 |
|
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3795
diff
changeset
|
183 |
NetDeviceContainer |
4140
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
184 |
CsmaHelper::Install (std::string nodeName) const |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
185 |
{ |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
186 |
Ptr<Node> node = Names::Find<Node> (nodeName); |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
187 |
return Install (node); |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
188 |
} |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
189 |
|
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
190 |
NetDeviceContainer |
3848
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3795
diff
changeset
|
191 |
CsmaHelper::Install (Ptr<Node> node, Ptr<CsmaChannel> channel) const |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3795
diff
changeset
|
192 |
{ |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3795
diff
changeset
|
193 |
return NetDeviceContainer (InstallPriv (node, channel)); |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3795
diff
changeset
|
194 |
} |
2780
306f665014b6
add ascii and pcap tracing support to csma helper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2656
diff
changeset
|
195 |
|
4140
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
196 |
NetDeviceContainer |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
197 |
CsmaHelper::Install (Ptr<Node> node, std::string channelName) const |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
198 |
{ |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
199 |
Ptr<CsmaChannel> channel = Names::Find<CsmaChannel> (channelName); |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
200 |
return NetDeviceContainer (InstallPriv (node, channel)); |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
201 |
} |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
202 |
|
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
203 |
NetDeviceContainer |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
204 |
CsmaHelper::Install (std::string nodeName, Ptr<CsmaChannel> channel) const |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
205 |
{ |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
206 |
Ptr<Node> node = Names::Find<Node> (nodeName); |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
207 |
return NetDeviceContainer (InstallPriv (node, channel)); |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
208 |
} |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
209 |
|
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
210 |
NetDeviceContainer |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
211 |
CsmaHelper::Install (std::string nodeName, std::string channelName) const |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
212 |
{ |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
213 |
Ptr<Node> node = Names::Find<Node> (nodeName); |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
214 |
Ptr<CsmaChannel> channel = Names::Find<CsmaChannel> (channelName); |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
215 |
return NetDeviceContainer (InstallPriv (node, channel)); |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
216 |
} |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
217 |
|
2418
4ff45fa08781
an initial draft of helper classes. don't work yet.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
218 |
NetDeviceContainer |
3848
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3795
diff
changeset
|
219 |
CsmaHelper::Install (const NodeContainer &c) const |
2418
4ff45fa08781
an initial draft of helper classes. don't work yet.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
220 |
{ |
4ff45fa08781
an initial draft of helper classes. don't work yet.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
221 |
Ptr<CsmaChannel> channel = m_channelFactory.Create ()->GetObject<CsmaChannel> (); |
3848
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3795
diff
changeset
|
222 |
|
2887
9a637e6daee0
Build -> Install
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2839
diff
changeset
|
223 |
return Install (c, channel); |
2418
4ff45fa08781
an initial draft of helper classes. don't work yet.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
224 |
} |
4ff45fa08781
an initial draft of helper classes. don't work yet.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
225 |
|
4ff45fa08781
an initial draft of helper classes. don't work yet.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
226 |
NetDeviceContainer |
3848
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3795
diff
changeset
|
227 |
CsmaHelper::Install (const NodeContainer &c, Ptr<CsmaChannel> channel) const |
2418
4ff45fa08781
an initial draft of helper classes. don't work yet.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
228 |
{ |
3848
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3795
diff
changeset
|
229 |
NetDeviceContainer devs; |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3795
diff
changeset
|
230 |
|
2418
4ff45fa08781
an initial draft of helper classes. don't work yet.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
231 |
for (NodeContainer::Iterator i = c.Begin (); i != c.End (); i++) |
4ff45fa08781
an initial draft of helper classes. don't work yet.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
232 |
{ |
3848
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3795
diff
changeset
|
233 |
devs.Add (InstallPriv (*i, channel)); |
2418
4ff45fa08781
an initial draft of helper classes. don't work yet.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
234 |
} |
3848
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3795
diff
changeset
|
235 |
|
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3795
diff
changeset
|
236 |
return devs; |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3795
diff
changeset
|
237 |
} |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3795
diff
changeset
|
238 |
|
4140
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
239 |
NetDeviceContainer |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
240 |
CsmaHelper::Install (const NodeContainer &c, std::string channelName) const |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
241 |
{ |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
242 |
Ptr<CsmaChannel> channel = Names::Find<CsmaChannel> (channelName); |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
243 |
return Install (c, channel); |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
244 |
} |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
245 |
|
3848
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3795
diff
changeset
|
246 |
Ptr<NetDevice> |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3795
diff
changeset
|
247 |
CsmaHelper::InstallPriv (Ptr<Node> node, Ptr<CsmaChannel> channel) const |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3795
diff
changeset
|
248 |
{ |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3795
diff
changeset
|
249 |
Ptr<CsmaNetDevice> device = m_deviceFactory.Create<CsmaNetDevice> (); |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3795
diff
changeset
|
250 |
device->SetAddress (Mac48Address::Allocate ()); |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3795
diff
changeset
|
251 |
node->AddDevice (device); |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3795
diff
changeset
|
252 |
Ptr<Queue> queue = m_queueFactory.Create<Queue> (); |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3795
diff
changeset
|
253 |
device->SetQueue (queue); |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3795
diff
changeset
|
254 |
device->Attach (channel); |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3795
diff
changeset
|
255 |
|
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3795
diff
changeset
|
256 |
return device; |
2418
4ff45fa08781
an initial draft of helper classes. don't work yet.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
257 |
} |
4ff45fa08781
an initial draft of helper classes. don't work yet.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
258 |
|
2780
306f665014b6
add ascii and pcap tracing support to csma helper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2656
diff
changeset
|
259 |
void |
3795
707acdf0f8b3
csma version of install star and example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3789
diff
changeset
|
260 |
CsmaHelper::InstallStar (Ptr<Node> hub, NodeContainer spokes, |
707acdf0f8b3
csma version of install star and example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3789
diff
changeset
|
261 |
NetDeviceContainer& hubDevices, NetDeviceContainer& spokeDevices) |
707acdf0f8b3
csma version of install star and example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3789
diff
changeset
|
262 |
{ |
707acdf0f8b3
csma version of install star and example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3789
diff
changeset
|
263 |
for (uint32_t i = 0; i < spokes.GetN (); ++i) |
707acdf0f8b3
csma version of install star and example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3789
diff
changeset
|
264 |
{ |
707acdf0f8b3
csma version of install star and example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3789
diff
changeset
|
265 |
NodeContainer nodes (hub, spokes.Get (i)); |
707acdf0f8b3
csma version of install star and example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3789
diff
changeset
|
266 |
NetDeviceContainer nd = Install (nodes); |
707acdf0f8b3
csma version of install star and example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3789
diff
changeset
|
267 |
hubDevices.Add (nd.Get (0)); |
707acdf0f8b3
csma version of install star and example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3789
diff
changeset
|
268 |
spokeDevices.Add (nd.Get (1)); |
707acdf0f8b3
csma version of install star and example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3789
diff
changeset
|
269 |
} |
707acdf0f8b3
csma version of install star and example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3789
diff
changeset
|
270 |
} |
707acdf0f8b3
csma version of install star and example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3789
diff
changeset
|
271 |
|
707acdf0f8b3
csma version of install star and example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3789
diff
changeset
|
272 |
void |
4140
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
273 |
CsmaHelper::InstallStar (std::string hubName, NodeContainer spokes, |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
274 |
NetDeviceContainer& hubDevices, NetDeviceContainer& spokeDevices) |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
275 |
{ |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
276 |
Ptr<Node> hub = Names::Find<Node> (hubName); |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
277 |
InstallStar (hub, spokes, hubDevices, spokeDevices); |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
278 |
} |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
279 |
|
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
280 |
void |
4263
fec2f830d015
trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
281 |
CsmaHelper::SniffEvent (Ptr<PcapWriter> writer, Ptr<const Packet> packet) |
2780
306f665014b6
add ascii and pcap tracing support to csma helper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2656
diff
changeset
|
282 |
{ |
306f665014b6
add ascii and pcap tracing support to csma helper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2656
diff
changeset
|
283 |
writer->WritePacket (packet); |
306f665014b6
add ascii and pcap tracing support to csma helper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2656
diff
changeset
|
284 |
} |
4263
fec2f830d015
trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
285 |
|
2780
306f665014b6
add ascii and pcap tracing support to csma helper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2656
diff
changeset
|
286 |
void |
2799
17660e306cab
Prepend ascii trace lines with action and time
Tom Henderson <tomh@tomh.org>
parents:
2789
diff
changeset
|
287 |
CsmaHelper::AsciiEnqueueEvent (std::ostream *os, std::string path, Ptr<const Packet> packet) |
2780
306f665014b6
add ascii and pcap tracing support to csma helper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2656
diff
changeset
|
288 |
{ |
2799
17660e306cab
Prepend ascii trace lines with action and time
Tom Henderson <tomh@tomh.org>
parents:
2789
diff
changeset
|
289 |
*os << "+ " << Simulator::Now ().GetSeconds () << " "; |
17660e306cab
Prepend ascii trace lines with action and time
Tom Henderson <tomh@tomh.org>
parents:
2789
diff
changeset
|
290 |
*os << path << " " << *packet << std::endl; |
17660e306cab
Prepend ascii trace lines with action and time
Tom Henderson <tomh@tomh.org>
parents:
2789
diff
changeset
|
291 |
} |
17660e306cab
Prepend ascii trace lines with action and time
Tom Henderson <tomh@tomh.org>
parents:
2789
diff
changeset
|
292 |
|
17660e306cab
Prepend ascii trace lines with action and time
Tom Henderson <tomh@tomh.org>
parents:
2789
diff
changeset
|
293 |
void |
17660e306cab
Prepend ascii trace lines with action and time
Tom Henderson <tomh@tomh.org>
parents:
2789
diff
changeset
|
294 |
CsmaHelper::AsciiDequeueEvent (std::ostream *os, std::string path, Ptr<const Packet> packet) |
17660e306cab
Prepend ascii trace lines with action and time
Tom Henderson <tomh@tomh.org>
parents:
2789
diff
changeset
|
295 |
{ |
17660e306cab
Prepend ascii trace lines with action and time
Tom Henderson <tomh@tomh.org>
parents:
2789
diff
changeset
|
296 |
*os << "- " << Simulator::Now ().GetSeconds () << " "; |
2780
306f665014b6
add ascii and pcap tracing support to csma helper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2656
diff
changeset
|
297 |
*os << path << " " << *packet << std::endl; |
306f665014b6
add ascii and pcap tracing support to csma helper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2656
diff
changeset
|
298 |
} |
306f665014b6
add ascii and pcap tracing support to csma helper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2656
diff
changeset
|
299 |
|
2799
17660e306cab
Prepend ascii trace lines with action and time
Tom Henderson <tomh@tomh.org>
parents:
2789
diff
changeset
|
300 |
void |
17660e306cab
Prepend ascii trace lines with action and time
Tom Henderson <tomh@tomh.org>
parents:
2789
diff
changeset
|
301 |
CsmaHelper::AsciiDropEvent (std::ostream *os, std::string path, Ptr<const Packet> packet) |
17660e306cab
Prepend ascii trace lines with action and time
Tom Henderson <tomh@tomh.org>
parents:
2789
diff
changeset
|
302 |
{ |
17660e306cab
Prepend ascii trace lines with action and time
Tom Henderson <tomh@tomh.org>
parents:
2789
diff
changeset
|
303 |
*os << "d " << Simulator::Now ().GetSeconds () << " "; |
17660e306cab
Prepend ascii trace lines with action and time
Tom Henderson <tomh@tomh.org>
parents:
2789
diff
changeset
|
304 |
*os << path << " " << *packet << std::endl; |
17660e306cab
Prepend ascii trace lines with action and time
Tom Henderson <tomh@tomh.org>
parents:
2789
diff
changeset
|
305 |
} |
17660e306cab
Prepend ascii trace lines with action and time
Tom Henderson <tomh@tomh.org>
parents:
2789
diff
changeset
|
306 |
|
17660e306cab
Prepend ascii trace lines with action and time
Tom Henderson <tomh@tomh.org>
parents:
2789
diff
changeset
|
307 |
void |
17660e306cab
Prepend ascii trace lines with action and time
Tom Henderson <tomh@tomh.org>
parents:
2789
diff
changeset
|
308 |
CsmaHelper::AsciiRxEvent (std::ostream *os, std::string path, Ptr<const Packet> packet) |
17660e306cab
Prepend ascii trace lines with action and time
Tom Henderson <tomh@tomh.org>
parents:
2789
diff
changeset
|
309 |
{ |
17660e306cab
Prepend ascii trace lines with action and time
Tom Henderson <tomh@tomh.org>
parents:
2789
diff
changeset
|
310 |
*os << "r " << Simulator::Now ().GetSeconds () << " "; |
17660e306cab
Prepend ascii trace lines with action and time
Tom Henderson <tomh@tomh.org>
parents:
2789
diff
changeset
|
311 |
*os << path << " " << *packet << std::endl; |
17660e306cab
Prepend ascii trace lines with action and time
Tom Henderson <tomh@tomh.org>
parents:
2789
diff
changeset
|
312 |
} |
2418
4ff45fa08781
an initial draft of helper classes. don't work yet.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
313 |
|
4ff45fa08781
an initial draft of helper classes. don't work yet.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
314 |
} // namespace ns3 |