author | Tom Henderson <tomh@tomh.org> |
Mon, 28 Sep 2015 20:27:25 -0700 | |
changeset 11676 | 05ea1489e509 |
parent 11618 | 1de158f7e17a |
permissions | -rw-r--r-- |
11430
f7ad31ac51d3
Missing mode lines.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11336
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
f7ad31ac51d3
Missing mode lines.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11336
diff
changeset
|
2 |
/* |
f7ad31ac51d3
Missing mode lines.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11336
diff
changeset
|
3 |
* This program is free software; you can redistribute it and/or modify |
5776 | 4 |
* it under the terms of the GNU General Public License version 2 as |
5 |
* published by the Free Software Foundation; |
|
6 |
* |
|
7 |
* This program is distributed in the hope that it will be useful, |
|
8 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
9 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
10 |
* GNU General Public License for more details. |
|
11 |
* |
|
12 |
* You should have received a copy of the GNU General Public License |
|
13 |
* along with this program; if not, write to the Free Software |
|
14 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
15 |
* |
|
16 |
* Author: George F. Riley<riley@ece.gatech.edu> |
|
7360
5949904cf955
Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents:
7256
diff
changeset
|
17 |
* Modified by: John Abraham <john.abraham@gatech.edu> |
10490
c7db6722e980
"Contribution" tags added
Evgeny Kalishenko <ydginster@gmail.com>
parents:
10488
diff
changeset
|
18 |
* Contributions: Eugene Kalishenko <ydginster@gmail.com> (Open Source and Linux Laboratory http://dev.osll.ru/) |
5776 | 19 |
*/ |
20 |
||
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
21 |
// Interface between ns-3 and the network animator |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
22 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
23 |
|
5776 | 24 |
|
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
25 |
#include <cstdio> |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
26 |
#include <unistd.h> |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
27 |
#include <sstream> |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
28 |
#include <fstream> |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
29 |
#include <string> |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
30 |
#include <iomanip> |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
31 |
#include <map> |
7368
eaf06b48cb5c
Missing header files since modularization for socket cases
John Abraham <john.abraham@gatech.edu>
parents:
7362
diff
changeset
|
32 |
|
eaf06b48cb5c
Missing header files since modularization for socket cases
John Abraham <john.abraham@gatech.edu>
parents:
7362
diff
changeset
|
33 |
// ns3 includes |
eaf06b48cb5c
Missing header files since modularization for socket cases
John Abraham <john.abraham@gatech.edu>
parents:
7362
diff
changeset
|
34 |
#include "ns3/animation-interface.h" |
eaf06b48cb5c
Missing header files since modularization for socket cases
John Abraham <john.abraham@gatech.edu>
parents:
7362
diff
changeset
|
35 |
#include "ns3/channel.h" |
eaf06b48cb5c
Missing header files since modularization for socket cases
John Abraham <john.abraham@gatech.edu>
parents:
7362
diff
changeset
|
36 |
#include "ns3/config.h" |
eaf06b48cb5c
Missing header files since modularization for socket cases
John Abraham <john.abraham@gatech.edu>
parents:
7362
diff
changeset
|
37 |
#include "ns3/node.h" |
eaf06b48cb5c
Missing header files since modularization for socket cases
John Abraham <john.abraham@gatech.edu>
parents:
7362
diff
changeset
|
38 |
#include "ns3/mobility-model.h" |
eaf06b48cb5c
Missing header files since modularization for socket cases
John Abraham <john.abraham@gatech.edu>
parents:
7362
diff
changeset
|
39 |
#include "ns3/packet.h" |
eaf06b48cb5c
Missing header files since modularization for socket cases
John Abraham <john.abraham@gatech.edu>
parents:
7362
diff
changeset
|
40 |
#include "ns3/simulator.h" |
eaf06b48cb5c
Missing header files since modularization for socket cases
John Abraham <john.abraham@gatech.edu>
parents:
7362
diff
changeset
|
41 |
#include "ns3/wifi-mac-header.h" |
eaf06b48cb5c
Missing header files since modularization for socket cases
John Abraham <john.abraham@gatech.edu>
parents:
7362
diff
changeset
|
42 |
#include "ns3/wimax-mac-header.h" |
7804
5ccfa6a97f71
NetAnim: Handle special case for missing Wifi TxTrace
John Abraham <john.abraham@gatech.edu>
parents:
7770
diff
changeset
|
43 |
#include "ns3/wifi-net-device.h" |
5ccfa6a97f71
NetAnim: Handle special case for missing Wifi TxTrace
John Abraham <john.abraham@gatech.edu>
parents:
7770
diff
changeset
|
44 |
#include "ns3/wifi-mac.h" |
7564
642fa0627ba6
NetAnim: Reduce config verbosity, provide utility for setting position
John Abraham <john.abraham@gatech.edu>
parents:
7561
diff
changeset
|
45 |
#include "ns3/constant-position-mobility-model.h" |
8807
fcb718d36baa
NetAnim: Update LTE callbacks after recent lena commit
John Abraham <john.abraham@gatech.edu>
parents:
8804
diff
changeset
|
46 |
#include "ns3/lte-ue-phy.h" |
fcb718d36baa
NetAnim: Update LTE callbacks after recent lena commit
John Abraham <john.abraham@gatech.edu>
parents:
8804
diff
changeset
|
47 |
#include "ns3/lte-enb-phy.h" |
8861
b1f287b36ff7
NetAnim: Add tentative Uan Phy Gen callback
John Abraham <john.abraham@gatech.edu>
parents:
8807
diff
changeset
|
48 |
#include "ns3/uan-net-device.h" |
b1f287b36ff7
NetAnim: Add tentative Uan Phy Gen callback
John Abraham <john.abraham@gatech.edu>
parents:
8807
diff
changeset
|
49 |
#include "ns3/uan-mac.h" |
8955
eab99e446e8c
NetAnim: Support End-point Ipv4 address on link display
John Abraham <john.abraham.in@gmail.com>
parents:
8948
diff
changeset
|
50 |
#include "ns3/ipv4.h" |
10485
83fc28889371
Added remaining energy tracing (Task #4593)
Evgeny Kalishenko <ydginster@gmail.com>
parents:
10197
diff
changeset
|
51 |
#include "ns3/ipv4-routing-protocol.h" |
83fc28889371
Added remaining energy tracing (Task #4593)
Evgeny Kalishenko <ydginster@gmail.com>
parents:
10197
diff
changeset
|
52 |
#include "ns3/energy-source-container.h" |
7368
eaf06b48cb5c
Missing header files since modularization for socket cases
John Abraham <john.abraham@gatech.edu>
parents:
7362
diff
changeset
|
53 |
|
10968
2d29fee2b7b8
[Bug 1551] Redux: NS_LOG_COMPONENT_DEFINE inside or outside of ns3 namespace?
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10843
diff
changeset
|
54 |
namespace ns3 { |
5776 | 55 |
|
10968
2d29fee2b7b8
[Bug 1551] Redux: NS_LOG_COMPONENT_DEFINE inside or outside of ns3 namespace?
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10843
diff
changeset
|
56 |
NS_LOG_COMPONENT_DEFINE ("AnimationInterface"); |
7823
2a669a0c452e
NetAnim: Add description to NodeContainers
John Abraham <john.abraham@gatech.edu>
parents:
7808
diff
changeset
|
57 |
|
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
58 |
// Globals |
9012
e1353799d7c6
NetAnim: Bump version
John Abraham <john.abraham.in@gmail.com>
parents:
8978
diff
changeset
|
59 |
|
7606
958775025f35
NetAnim: One time initialization, fixes for long duration runs
John Abraham <john.abraham@gatech.edu>
parents:
7595
diff
changeset
|
60 |
static bool initialized = false; |
8928
95b9af52352f
NetAnim: Support for link description
John Abraham <john.abraham.in@gmail.com>
parents:
8898
diff
changeset
|
61 |
|
5776 | 62 |
|
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
63 |
// Public methods |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
64 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
65 |
AnimationInterface::AnimationInterface (const std::string fn) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
66 |
: m_f (0), |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
67 |
m_routingF (0), |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
68 |
m_mobilityPollInterval (Seconds (0.25)), |
8803
e51a5a77909c
NetAnim: VALGR still reachable
John Abraham <john.abraham@gatech.edu>
parents:
8778
diff
changeset
|
69 |
m_outputFileName (fn), |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
70 |
gAnimUid (0), |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
71 |
m_writeCallback (0), |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
72 |
m_started (false), |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
73 |
m_enablePacketMetadata (false), |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
74 |
m_startTime (Seconds (0)), |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
75 |
m_stopTime (Seconds (3600 * 1000)), |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
76 |
m_maxPktsPerFile (MAX_PKTS_PER_TRACE_FILE), |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
77 |
m_originalFileName (fn), |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
78 |
m_routingStopTime (Seconds (0)), |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
79 |
m_routingFileName (""), |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
80 |
m_routingPollInterval (Seconds (5)), |
10578
6cdf44cd956e
NetAnim: Add ability to skip all packet tracing
John Abraham <john.abraham.in@gmail.com>
parents:
10574
diff
changeset
|
81 |
m_trackPackets (true) |
7360
5949904cf955
Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents:
7256
diff
changeset
|
82 |
{ |
7606
958775025f35
NetAnim: One time initialization, fixes for long duration runs
John Abraham <john.abraham@gatech.edu>
parents:
7595
diff
changeset
|
83 |
initialized = true; |
7564
642fa0627ba6
NetAnim: Reduce config verbosity, provide utility for setting position
John Abraham <john.abraham@gatech.edu>
parents:
7561
diff
changeset
|
84 |
StartAnimation (); |
7360
5949904cf955
Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents:
7256
diff
changeset
|
85 |
} |
5949904cf955
Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents:
7256
diff
changeset
|
86 |
|
5776 | 87 |
AnimationInterface::~AnimationInterface () |
88 |
{ |
|
7360
5949904cf955
Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents:
7256
diff
changeset
|
89 |
StopAnimation (); |
5949904cf955
Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents:
7256
diff
changeset
|
90 |
} |
5949904cf955
Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents:
7256
diff
changeset
|
91 |
|
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
92 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
93 |
AnimationInterface::SkipPacketTracing () |
10578
6cdf44cd956e
NetAnim: Add ability to skip all packet tracing
John Abraham <john.abraham.in@gmail.com>
parents:
10574
diff
changeset
|
94 |
{ |
6cdf44cd956e
NetAnim: Add ability to skip all packet tracing
John Abraham <john.abraham.in@gmail.com>
parents:
10574
diff
changeset
|
95 |
m_trackPackets = false; |
6cdf44cd956e
NetAnim: Add ability to skip all packet tracing
John Abraham <john.abraham.in@gmail.com>
parents:
10574
diff
changeset
|
96 |
} |
6cdf44cd956e
NetAnim: Add ability to skip all packet tracing
John Abraham <john.abraham.in@gmail.com>
parents:
10574
diff
changeset
|
97 |
|
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
98 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
99 |
AnimationInterface::EnableWifiPhyCounters (Time startTime, Time stopTime, Time pollInterval) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
100 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
101 |
m_wifiPhyCountersStopTime = stopTime; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
102 |
m_wifiPhyCountersPollInterval = pollInterval; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
103 |
m_wifiPhyTxDropCounterId = AddNodeCounter ("WifiPhy TxDrop", AnimationInterface::DOUBLE_COUNTER); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
104 |
m_wifiPhyRxDropCounterId = AddNodeCounter ("WifiPhy RxDrop", AnimationInterface::DOUBLE_COUNTER); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
105 |
for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); ++i) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
106 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
107 |
Ptr<Node> n = *i; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
108 |
m_nodeWifiPhyTxDrop[n->GetId ()] = 0; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
109 |
m_nodeWifiPhyRxDrop[n->GetId ()] = 0; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
110 |
UpdateNodeCounter (m_wifiPhyTxDropCounterId, n->GetId (), 0); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
111 |
UpdateNodeCounter (m_wifiPhyRxDropCounterId, n->GetId (), 0); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
112 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
113 |
Simulator::Schedule (startTime, &AnimationInterface::TrackWifiPhyCounters, this); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
114 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
115 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
116 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
117 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
118 |
AnimationInterface::EnableWifiMacCounters (Time startTime, Time stopTime, Time pollInterval) |
9161
9c62cfdc7946
NetAnim: Add support for tracking routing table
John Abraham <john.abraham.in@gmail.com>
parents:
9158
diff
changeset
|
119 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
120 |
m_wifiMacCountersStopTime = stopTime; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
121 |
m_wifiMacCountersPollInterval = pollInterval; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
122 |
m_wifiMacTxCounterId = AddNodeCounter ("WifiMac Tx", AnimationInterface::DOUBLE_COUNTER); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
123 |
m_wifiMacTxDropCounterId = AddNodeCounter ("WifiMac TxDrop", AnimationInterface::DOUBLE_COUNTER); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
124 |
m_wifiMacRxCounterId = AddNodeCounter ("WifiMac Rx", AnimationInterface::DOUBLE_COUNTER); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
125 |
m_wifiMacRxDropCounterId = AddNodeCounter ("WifiMac RxDrop", AnimationInterface::DOUBLE_COUNTER); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
126 |
for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); ++i) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
127 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
128 |
Ptr<Node> n = *i; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
129 |
m_nodeWifiMacTx[n->GetId ()] = 0; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
130 |
m_nodeWifiMacTxDrop[n->GetId ()] = 0; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
131 |
m_nodeWifiMacRx[n->GetId ()] = 0; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
132 |
m_nodeWifiMacRxDrop[n->GetId ()] = 0; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
133 |
UpdateNodeCounter (m_wifiMacTxCounterId, n->GetId (), 0); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
134 |
UpdateNodeCounter (m_wifiMacTxDropCounterId, n->GetId (), 0); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
135 |
UpdateNodeCounter (m_wifiMacRxCounterId, n->GetId (), 0); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
136 |
UpdateNodeCounter (m_wifiMacRxDropCounterId, n->GetId (), 0); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
137 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
138 |
Simulator::Schedule (startTime, &AnimationInterface::TrackWifiMacCounters, this); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
139 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
140 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
141 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
142 |
AnimationInterface::EnableQueueCounters (Time startTime, Time stopTime, Time pollInterval) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
143 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
144 |
m_queueCountersStopTime = stopTime; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
145 |
m_queueCountersPollInterval = pollInterval; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
146 |
m_queueEnqueueCounterId = AddNodeCounter ("Enqueue", AnimationInterface::DOUBLE_COUNTER); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
147 |
m_queueDequeueCounterId = AddNodeCounter ("Dequeue", AnimationInterface::DOUBLE_COUNTER); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
148 |
m_queueDropCounterId = AddNodeCounter ("Queue Drop", AnimationInterface::DOUBLE_COUNTER); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
149 |
for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); ++i) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
150 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
151 |
Ptr<Node> n = *i; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
152 |
m_nodeQueueEnqueue[n->GetId ()] = 0; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
153 |
m_nodeQueueDequeue[n->GetId ()] = 0; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
154 |
m_nodeQueueDrop[n->GetId ()] = 0; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
155 |
UpdateNodeCounter (m_queueEnqueueCounterId, n->GetId (), 0); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
156 |
UpdateNodeCounter (m_queueDequeueCounterId, n->GetId (), 0); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
157 |
UpdateNodeCounter (m_queueDropCounterId, n->GetId (), 0); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
158 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
159 |
Simulator::Schedule (startTime, &AnimationInterface::TrackQueueCounters, this); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
160 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
161 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
162 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
163 |
AnimationInterface::EnableIpv4L3ProtocolCounters (Time startTime, Time stopTime, Time pollInterval) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
164 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
165 |
m_ipv4L3ProtocolCountersStopTime = stopTime; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
166 |
m_ipv4L3ProtocolCountersPollInterval = pollInterval; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
167 |
m_ipv4L3ProtocolTxCounterId = AddNodeCounter ("Ipv4 Tx", AnimationInterface::DOUBLE_COUNTER); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
168 |
m_ipv4L3ProtocolRxCounterId = AddNodeCounter ("Ipv4 Rx", AnimationInterface::DOUBLE_COUNTER); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
169 |
m_ipv4L3ProtocolDropCounterId = AddNodeCounter ("Ipv4 Drop", AnimationInterface::DOUBLE_COUNTER); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
170 |
for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); ++i) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
171 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
172 |
Ptr<Node> n = *i; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
173 |
m_nodeIpv4Tx[n->GetId ()] = 0; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
174 |
m_nodeIpv4Rx[n->GetId ()] = 0; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
175 |
m_nodeIpv4Drop[n->GetId ()] = 0; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
176 |
UpdateNodeCounter (m_ipv4L3ProtocolTxCounterId, n->GetId (), 0); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
177 |
UpdateNodeCounter (m_ipv4L3ProtocolRxCounterId, n->GetId (), 0); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
178 |
UpdateNodeCounter (m_ipv4L3ProtocolDropCounterId, n->GetId (), 0); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
179 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
180 |
Simulator::Schedule (startTime, &AnimationInterface::TrackIpv4L3ProtocolCounters, this); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
181 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
182 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
183 |
AnimationInterface & |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
184 |
AnimationInterface::EnableIpv4RouteTracking (std::string fileName, Time startTime, Time stopTime, Time pollInterval) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
185 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
186 |
SetOutputFile (fileName, true); |
9161
9c62cfdc7946
NetAnim: Add support for tracking routing table
John Abraham <john.abraham.in@gmail.com>
parents:
9158
diff
changeset
|
187 |
m_routingStopTime = stopTime; |
9c62cfdc7946
NetAnim: Add support for tracking routing table
John Abraham <john.abraham.in@gmail.com>
parents:
9158
diff
changeset
|
188 |
m_routingPollInterval = pollInterval; |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
189 |
WriteXmlAnim (true); |
9161
9c62cfdc7946
NetAnim: Add support for tracking routing table
John Abraham <john.abraham.in@gmail.com>
parents:
9158
diff
changeset
|
190 |
Simulator::Schedule (startTime, &AnimationInterface::TrackIpv4Route, this); |
9246
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
191 |
return *this; |
9161
9c62cfdc7946
NetAnim: Add support for tracking routing table
John Abraham <john.abraham.in@gmail.com>
parents:
9158
diff
changeset
|
192 |
} |
9c62cfdc7946
NetAnim: Add support for tracking routing table
John Abraham <john.abraham.in@gmail.com>
parents:
9158
diff
changeset
|
193 |
|
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
194 |
AnimationInterface & |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
195 |
AnimationInterface::EnableIpv4RouteTracking (std::string fileName, Time startTime, Time stopTime, NodeContainer nc, Time pollInterval) |
9161
9c62cfdc7946
NetAnim: Add support for tracking routing table
John Abraham <john.abraham.in@gmail.com>
parents:
9158
diff
changeset
|
196 |
{ |
9c62cfdc7946
NetAnim: Add support for tracking routing table
John Abraham <john.abraham.in@gmail.com>
parents:
9158
diff
changeset
|
197 |
m_routingNc = nc; |
9246
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
198 |
return EnableIpv4RouteTracking (fileName, startTime, stopTime, pollInterval); |
9161
9c62cfdc7946
NetAnim: Add support for tracking routing table
John Abraham <john.abraham.in@gmail.com>
parents:
9158
diff
changeset
|
199 |
} |
9c62cfdc7946
NetAnim: Add support for tracking routing table
John Abraham <john.abraham.in@gmail.com>
parents:
9158
diff
changeset
|
200 |
|
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
201 |
AnimationInterface & |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
202 |
AnimationInterface::AddSourceDestination (uint32_t fromNodeId, std::string ipv4Address) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
203 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
204 |
Ipv4RouteTrackElement element = { ipv4Address, fromNodeId }; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
205 |
m_ipv4RouteTrackElements.push_back (element); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
206 |
return *this; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
207 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
208 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
209 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
210 |
AnimationInterface::SetStartTime (Time t) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
211 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
212 |
m_startTime = t; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
213 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
214 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
215 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
216 |
AnimationInterface::SetStopTime (Time t) |
9161
9c62cfdc7946
NetAnim: Add support for tracking routing table
John Abraham <john.abraham.in@gmail.com>
parents:
9158
diff
changeset
|
217 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
218 |
m_stopTime = t; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
219 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
220 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
221 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
222 |
AnimationInterface::SetMaxPktsPerTraceFile (uint64_t maxPacketsPerFile) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
223 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
224 |
m_maxPktsPerFile = maxPacketsPerFile; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
225 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
226 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
227 |
uint32_t |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
228 |
AnimationInterface::AddNodeCounter (std::string counterName, CounterType counterType) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
229 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
230 |
m_nodeCounters.push_back (counterName); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
231 |
uint32_t counterId = m_nodeCounters.size () - 1; // counter ID is zero-indexed |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
232 |
WriteXmlAddNodeCounter (counterId, counterName, counterType); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
233 |
return counterId; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
234 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
235 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
236 |
uint32_t |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
237 |
AnimationInterface::AddResource (std::string resourcePath) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
238 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
239 |
m_resources.push_back (resourcePath); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
240 |
uint32_t resourceId = m_resources.size () - 1; // resource ID is zero-indexed |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
241 |
WriteXmlAddResource (resourceId, resourcePath); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
242 |
return resourceId; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
243 |
} |
9161
9c62cfdc7946
NetAnim: Add support for tracking routing table
John Abraham <john.abraham.in@gmail.com>
parents:
9158
diff
changeset
|
244 |
|
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
245 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
246 |
AnimationInterface::EnablePacketMetadata (bool enable) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
247 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
248 |
m_enablePacketMetadata = enable; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
249 |
if (enable) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
250 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
251 |
Packet::EnablePrinting (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
252 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
253 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
254 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
255 |
bool |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
256 |
AnimationInterface::IsInitialized () |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
257 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
258 |
return initialized; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
259 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
260 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
261 |
bool |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
262 |
AnimationInterface::IsStarted () |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
263 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
264 |
return m_started; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
265 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
266 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
267 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
268 |
AnimationInterface::SetAnimWriteCallback (AnimWriteCallback cb) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
269 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
270 |
m_writeCallback = cb; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
271 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
272 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
273 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
274 |
AnimationInterface::ResetAnimWriteCallback () |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
275 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
276 |
m_writeCallback = 0; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
277 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
278 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
279 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
280 |
AnimationInterface::SetMobilityPollInterval (Time t) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
281 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
282 |
m_mobilityPollInterval = t; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
283 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
284 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
285 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
286 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
287 |
AnimationInterface::SetConstantPosition (Ptr <Node> n, double x, double y, double z) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
288 |
{ |
9161
9c62cfdc7946
NetAnim: Add support for tracking routing table
John Abraham <john.abraham.in@gmail.com>
parents:
9158
diff
changeset
|
289 |
NS_ASSERT (n); |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
290 |
Ptr<ConstantPositionMobilityModel> loc = n->GetObject<ConstantPositionMobilityModel> (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
291 |
if (loc == 0) |
9161
9c62cfdc7946
NetAnim: Add support for tracking routing table
John Abraham <john.abraham.in@gmail.com>
parents:
9158
diff
changeset
|
292 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
293 |
loc = CreateObject<ConstantPositionMobilityModel> (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
294 |
n->AggregateObject (loc); |
9161
9c62cfdc7946
NetAnim: Add support for tracking routing table
John Abraham <john.abraham.in@gmail.com>
parents:
9158
diff
changeset
|
295 |
} |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
296 |
Vector hubVec (x, y, z); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
297 |
loc->SetPosition (hubVec); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
298 |
NS_LOG_INFO ("Node:" << n->GetId () << " Position set to:(" << x << "," << y << "," << z << ")"); |
9161
9c62cfdc7946
NetAnim: Add support for tracking routing table
John Abraham <john.abraham.in@gmail.com>
parents:
9158
diff
changeset
|
299 |
|
9c62cfdc7946
NetAnim: Add support for tracking routing table
John Abraham <john.abraham.in@gmail.com>
parents:
9158
diff
changeset
|
300 |
} |
9c62cfdc7946
NetAnim: Add support for tracking routing table
John Abraham <john.abraham.in@gmail.com>
parents:
9158
diff
changeset
|
301 |
|
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
302 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
303 |
AnimationInterface::UpdateNodeImage (uint32_t nodeId, uint32_t resourceId) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
304 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
305 |
NS_LOG_INFO ("Setting node image for Node Id:" << nodeId); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
306 |
if (resourceId > (m_resources.size ()-1)) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
307 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
308 |
NS_FATAL_ERROR ("Resource Id:" << resourceId << " not found. Did you use AddResource?"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
309 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
310 |
WriteXmlUpdateNodeImage (nodeId, resourceId); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
311 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
312 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
313 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
314 |
AnimationInterface::UpdateNodeCounter (uint32_t nodeCounterId, uint32_t nodeId, double counter) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
315 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
316 |
if (nodeCounterId > (m_nodeCounters.size () - 1)) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
317 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
318 |
NS_FATAL_ERROR ("NodeCounter Id:" << nodeCounterId << " not found. Did you use AddNodeCounter?"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
319 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
320 |
WriteXmlUpdateNodeCounter (nodeCounterId, nodeId, counter); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
321 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
322 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
323 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
324 |
AnimationInterface::SetBackgroundImage (std::string fileName, double x, double y, double scaleX, double scaleY, double opacity) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
325 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
326 |
if ((opacity < 0) || (opacity > 1)) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
327 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
328 |
NS_FATAL_ERROR ("Opacity must be between 0.0 and 1.0"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
329 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
330 |
WriteXmlUpdateBackground (fileName, x, y, scaleX, scaleY, opacity); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
331 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
332 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
333 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
334 |
AnimationInterface::UpdateNodeSize (uint32_t nodeId, double width, double height) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
335 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
336 |
AnimationInterface::NodeSize s = { width, height }; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
337 |
m_nodeSizes[nodeId] = s; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
338 |
WriteXmlUpdateNodeSize (nodeId, s.width, s.height); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
339 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
340 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
341 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
342 |
AnimationInterface::UpdateNodeColor (Ptr <Node> n, uint8_t r, uint8_t g, uint8_t b) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
343 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
344 |
UpdateNodeColor (n->GetId (), r, g, b); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
345 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
346 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
347 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
348 |
AnimationInterface::UpdateNodeColor (uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
349 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
350 |
NS_ASSERT (NodeList::GetNode (nodeId)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
351 |
NS_LOG_INFO ("Setting node color for Node Id:" << nodeId); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
352 |
Rgb rgb = {r, g, b}; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
353 |
m_nodeColors[nodeId] = rgb; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
354 |
WriteXmlUpdateNodeColor (nodeId, r, g, b); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
355 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
356 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
357 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
358 |
AnimationInterface::UpdateLinkDescription (uint32_t fromNode, uint32_t toNode, |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
359 |
std::string linkDescription) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
360 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
361 |
WriteXmlUpdateLink (fromNode, toNode, linkDescription); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
362 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
363 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
364 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
365 |
AnimationInterface::UpdateLinkDescription (Ptr <Node> fromNode, Ptr <Node> toNode, |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
366 |
std::string linkDescription) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
367 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
368 |
NS_ASSERT (fromNode); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
369 |
NS_ASSERT (toNode); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
370 |
WriteXmlUpdateLink (fromNode->GetId (), toNode->GetId (), linkDescription); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
371 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
372 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
373 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
374 |
AnimationInterface::UpdateNodeDescription (Ptr <Node> n, std::string descr) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
375 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
376 |
UpdateNodeDescription (n->GetId (), descr); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
377 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
378 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
379 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
380 |
AnimationInterface::UpdateNodeDescription (uint32_t nodeId, std::string descr) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
381 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
382 |
NS_ASSERT (NodeList::GetNode (nodeId)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
383 |
m_nodeDescriptions[nodeId] = descr; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
384 |
WriteXmlUpdateNodeDescription (nodeId); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
385 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
386 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
387 |
// Private methods |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
388 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
389 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
390 |
double |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
391 |
AnimationInterface::GetNodeEnergyFraction (Ptr <const Node> node) const |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
392 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
393 |
const EnergyFractionMap::const_iterator fractionIter = m_nodeEnergyFraction.find (node->GetId ()); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
394 |
NS_ASSERT (fractionIter != m_nodeEnergyFraction.end ()); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
395 |
return fractionIter->second; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
396 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
397 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
398 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
399 |
AnimationInterface::MobilityCourseChangeTrace (Ptr <const MobilityModel> mobility) |
9246
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
400 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
401 |
if (!m_started || !IsInTimeWindow () || !m_trackPackets) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
402 |
return; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
403 |
Ptr <Node> n = mobility->GetObject <Node> (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
404 |
NS_ASSERT (n); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
405 |
Vector v ; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
406 |
if (!mobility) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
407 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
408 |
v = GetPosition (n); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
409 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
410 |
else |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
411 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
412 |
v = mobility->GetPosition (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
413 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
414 |
UpdatePosition (n, v); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
415 |
WriteXmlUpdateNodePosition (n->GetId (), v.x, v.y); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
416 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
417 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
418 |
bool |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
419 |
AnimationInterface::NodeHasMoved (Ptr <Node> n, Vector newLocation) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
420 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
421 |
Vector oldLocation = GetPosition (n); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
422 |
if ((ceil (oldLocation.x) == ceil (newLocation.x)) && |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
423 |
(ceil (oldLocation.y) == ceil (newLocation.y))) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
424 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
425 |
return false; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
426 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
427 |
else |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
428 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
429 |
return true; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
430 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
431 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
432 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
433 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
434 |
AnimationInterface::MobilityAutoCheck () |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
435 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
436 |
if (!m_started || !IsInTimeWindow ()) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
437 |
return; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
438 |
std::vector <Ptr <Node> > MovedNodes = GetMovedNodes (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
439 |
for (uint32_t i = 0; i < MovedNodes.size (); i++) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
440 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
441 |
Ptr <Node> n = MovedNodes [i]; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
442 |
NS_ASSERT (n); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
443 |
Vector v = GetPosition (n); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
444 |
WriteXmlUpdateNodePosition (n->GetId () , v.x, v.y); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
445 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
446 |
if (!Simulator::IsFinished ()) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
447 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
448 |
PurgePendingPackets (AnimationInterface::WIFI); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
449 |
PurgePendingPackets (AnimationInterface::WIMAX); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
450 |
PurgePendingPackets (AnimationInterface::LTE); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
451 |
PurgePendingPackets (AnimationInterface::CSMA); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
452 |
Simulator::Schedule (m_mobilityPollInterval, &AnimationInterface::MobilityAutoCheck, this); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
453 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
454 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
455 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
456 |
std::vector <Ptr <Node> > |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
457 |
AnimationInterface::GetMovedNodes () |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
458 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
459 |
std::vector < Ptr <Node> > movedNodes; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
460 |
for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); ++i) |
9247
740c45821021
NetAnim: Implement route path element XML tag
John Abraham <john.abraham.in@gmail.com>
parents:
9246
diff
changeset
|
461 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
462 |
Ptr<Node> n = *i; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
463 |
NS_ASSERT (n); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
464 |
Ptr <MobilityModel> mobility = n->GetObject <MobilityModel> (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
465 |
Vector newLocation; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
466 |
if (!mobility) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
467 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
468 |
newLocation = GetPosition (n); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
469 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
470 |
else |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
471 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
472 |
newLocation = mobility->GetPosition (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
473 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
474 |
if (!NodeHasMoved (n, newLocation)) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
475 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
476 |
continue; //Location has not changed |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
477 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
478 |
else |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
479 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
480 |
UpdatePosition (n, newLocation); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
481 |
movedNodes.push_back (n); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
482 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
483 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
484 |
return movedNodes; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
485 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
486 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
487 |
int |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
488 |
AnimationInterface::WriteN (const std::string& st, FILE * f) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
489 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
490 |
if (!f) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
491 |
return 0; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
492 |
if (m_writeCallback) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
493 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
494 |
m_writeCallback (st.c_str ()); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
495 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
496 |
return WriteN (st.c_str (), st.length (), f); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
497 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
498 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
499 |
int |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
500 |
AnimationInterface::WriteN (const char* data, uint32_t count, FILE * f) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
501 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
502 |
if (!f) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
503 |
return 0; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
504 |
// Write count bytes to h from data |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
505 |
uint32_t nLeft = count; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
506 |
const char* p = data; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
507 |
uint32_t written = 0; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
508 |
while (nLeft) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
509 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
510 |
int n = std::fwrite (p, 1, nLeft, f); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
511 |
if (n <= 0) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
512 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
513 |
return written; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
514 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
515 |
written += n; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
516 |
nLeft -= n; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
517 |
p += n; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
518 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
519 |
return written; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
520 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
521 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
522 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
523 |
AnimationInterface::WriteRoutePath (uint32_t nodeId, std::string destination, Ipv4RoutePathElements rpElements) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
524 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
525 |
NS_LOG_INFO ("Writing Route Path From :" << nodeId << " To: " << destination.c_str ()); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
526 |
WriteXmlRp (nodeId, destination, rpElements); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
527 |
/*for (Ipv4RoutePathElements::const_iterator i = rpElements.begin (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
528 |
i != rpElements.end (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
529 |
++i) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
530 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
531 |
Ipv4RoutePathElement rpElement = *i; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
532 |
NS_LOG_INFO ("Node:" << rpElement.nodeId << "-->" << rpElement.nextHop.c_str ()); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
533 |
WriteN (GetXmlRp (rpElement.node, GetIpv4RoutingTable (n)), m_routingF); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
534 |
|
9247
740c45821021
NetAnim: Implement route path element XML tag
John Abraham <john.abraham.in@gmail.com>
parents:
9246
diff
changeset
|
535 |
} |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
536 |
*/ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
537 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
538 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
539 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
540 |
AnimationInterface::WriteNonP2pLinkProperties (uint32_t id, std::string ipv4Address, std::string channelType) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
541 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
542 |
WriteXmlNonP2pLinkProperties (id, ipv4Address, channelType); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
543 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
544 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
545 |
const std::vector<std::string> |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
546 |
AnimationInterface::GetElementsFromContext (const std::string& context) const |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
547 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
548 |
std::vector <std::string> elements; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
549 |
size_t pos1=0, pos2; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
550 |
while (pos1 != context.npos) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
551 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
552 |
pos1 = context.find ("/",pos1); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
553 |
pos2 = context.find ("/",pos1+1); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
554 |
elements.push_back (context.substr (pos1+1,pos2-(pos1+1))); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
555 |
pos1 = pos2; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
556 |
pos2 = context.npos; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
557 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
558 |
return elements; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
559 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
560 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
561 |
Ptr <Node> |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
562 |
AnimationInterface::GetNodeFromContext (const std::string& context) const |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
563 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
564 |
// Use "NodeList/*/ as reference |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
565 |
// where element [1] is the Node Id |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
566 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
567 |
std::vector <std::string> elements = GetElementsFromContext (context); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
568 |
Ptr <Node> n = NodeList::GetNode (atoi (elements.at (1).c_str ())); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
569 |
NS_ASSERT (n); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
570 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
571 |
return n; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
572 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
573 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
574 |
Ptr <NetDevice> |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
575 |
AnimationInterface::GetNetDeviceFromContext (std::string context) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
576 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
577 |
// Use "NodeList/*/DeviceList/*/ as reference |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
578 |
// where element [1] is the Node Id |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
579 |
// element [2] is the NetDevice Id |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
580 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
581 |
std::vector <std::string> elements = GetElementsFromContext (context); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
582 |
Ptr <Node> n = GetNodeFromContext (context); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
583 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
584 |
return n->GetDevice (atoi (elements.at (3).c_str ())); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
585 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
586 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
587 |
uint64_t |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
588 |
AnimationInterface::GetAnimUidFromPacket (Ptr <const Packet> p) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
589 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
590 |
AnimByteTag tag; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
591 |
TypeId tid = tag.GetInstanceTypeId (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
592 |
ByteTagIterator i = p->GetByteTagIterator (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
593 |
bool found = false; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
594 |
while (i.HasNext ()) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
595 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
596 |
ByteTagIterator::Item item = i.Next (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
597 |
if (tid == item.GetTypeId ()) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
598 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
599 |
item.GetTag (tag); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
600 |
found = true; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
601 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
602 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
603 |
if (found) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
604 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
605 |
return tag.Get (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
606 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
607 |
else |
9246
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
608 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
609 |
return 0; |
9246
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
610 |
} |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
611 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
612 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
613 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
614 |
AnimationInterface::AddByteTag (uint64_t animUid, Ptr<const Packet> p) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
615 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
616 |
AnimByteTag tag; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
617 |
tag.Set (animUid); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
618 |
p->AddByteTag (tag); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
619 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
620 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
621 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
622 |
AnimationInterface::RemainingEnergyTrace (std::string context, double previousEnergy, double currentEnergy) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
623 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
624 |
if (!m_started || !IsInTimeWindow ()) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
625 |
return; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
626 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
627 |
const Ptr <const Node> node = GetNodeFromContext (context); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
628 |
const uint32_t nodeId = node->GetId (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
629 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
630 |
NS_LOG_INFO ("Remaining energy on one of sources on node " << nodeId << ": " << currentEnergy); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
631 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
632 |
const Ptr<EnergySource> energySource = node->GetObject<EnergySource> (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
633 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
634 |
NS_ASSERT (energySource); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
635 |
// Don't call GetEnergyFraction () because of recursion |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
636 |
const double energyFraction = currentEnergy / energySource->GetInitialEnergy (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
637 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
638 |
NS_LOG_INFO ("Total energy fraction on node " << nodeId << ": " << energyFraction); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
639 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
640 |
m_nodeEnergyFraction[nodeId] = energyFraction; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
641 |
UpdateNodeCounter (m_remainingEnergyCounterId, nodeId, energyFraction); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
642 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
643 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
644 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
645 |
AnimationInterface::WifiPhyTxDropTrace (std::string context, Ptr<const Packet> p) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
646 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
647 |
const Ptr <const Node> node = GetNodeFromContext (context); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
648 |
++m_nodeWifiPhyTxDrop[node->GetId ()]; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
649 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
650 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
651 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
652 |
AnimationInterface::WifiPhyRxDropTrace (std::string context, Ptr<const Packet> p) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
653 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
654 |
const Ptr <const Node> node = GetNodeFromContext (context); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
655 |
++m_nodeWifiPhyRxDrop[node->GetId ()]; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
656 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
657 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
658 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
659 |
AnimationInterface::WifiMacTxTrace (std::string context, Ptr<const Packet> p) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
660 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
661 |
const Ptr <const Node> node = GetNodeFromContext (context); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
662 |
++m_nodeWifiMacTx[node->GetId ()]; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
663 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
664 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
665 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
666 |
AnimationInterface::WifiMacTxDropTrace (std::string context, Ptr<const Packet> p) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
667 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
668 |
const Ptr <const Node> node = GetNodeFromContext (context); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
669 |
++m_nodeWifiMacTxDrop[node->GetId ()]; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
670 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
671 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
672 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
673 |
AnimationInterface::WifiMacRxTrace (std::string context, Ptr<const Packet> p) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
674 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
675 |
const Ptr <const Node> node = GetNodeFromContext (context); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
676 |
++m_nodeWifiMacRx[node->GetId ()]; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
677 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
678 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
679 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
680 |
AnimationInterface::WifiMacRxDropTrace (std::string context, Ptr<const Packet> p) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
681 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
682 |
const Ptr <const Node> node = GetNodeFromContext (context); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
683 |
++m_nodeWifiMacRxDrop[node->GetId ()]; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
684 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
685 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
686 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
687 |
AnimationInterface::Ipv4TxTrace (std::string context, Ptr<const Packet> p, Ptr<Ipv4> ipv4, uint32_t interfaceIndex) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
688 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
689 |
const Ptr <const Node> node = GetNodeFromContext (context); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
690 |
++m_nodeIpv4Tx[node->GetId ()]; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
691 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
692 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
693 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
694 |
AnimationInterface::Ipv4RxTrace (std::string context, Ptr<const Packet> p, Ptr<Ipv4> ipv4, uint32_t interfaceIndex) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
695 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
696 |
const Ptr <const Node> node = GetNodeFromContext (context); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
697 |
++m_nodeIpv4Rx[node->GetId ()]; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
698 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
699 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
700 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
701 |
AnimationInterface::Ipv4DropTrace (std::string context, |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
702 |
const Ipv4Header & ipv4Header, |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
703 |
Ptr<const Packet> p, |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
704 |
Ipv4L3Protocol::DropReason dropReason, |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
705 |
Ptr<Ipv4> ipv4, |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
706 |
uint32_t) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
707 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
708 |
const Ptr <const Node> node = GetNodeFromContext (context); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
709 |
++m_nodeIpv4Drop[node->GetId ()]; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
710 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
711 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
712 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
713 |
AnimationInterface::EnqueueTrace (std::string context, |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
714 |
Ptr<const Packet> p) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
715 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
716 |
const Ptr <const Node> node = GetNodeFromContext (context); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
717 |
++m_nodeQueueEnqueue[node->GetId ()]; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
718 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
719 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
720 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
721 |
AnimationInterface::DequeueTrace (std::string context, |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
722 |
Ptr<const Packet> p) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
723 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
724 |
const Ptr <const Node> node = GetNodeFromContext (context); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
725 |
++m_nodeQueueDequeue[node->GetId ()]; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
726 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
727 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
728 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
729 |
AnimationInterface::QueueDropTrace (std::string context, |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
730 |
Ptr<const Packet> p) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
731 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
732 |
const Ptr <const Node> node = GetNodeFromContext (context); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
733 |
++m_nodeQueueDrop[node->GetId ()]; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
734 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
735 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
736 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
737 |
AnimationInterface::DevTxTrace (std::string context, |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
738 |
Ptr<const Packet> p, |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
739 |
Ptr<NetDevice> tx, |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
740 |
Ptr<NetDevice> rx, |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
741 |
Time txTime, |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
742 |
Time rxTime) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
743 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
744 |
if (!m_started || !IsInTimeWindow () || !m_trackPackets) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
745 |
return; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
746 |
NS_ASSERT (tx); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
747 |
NS_ASSERT (rx); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
748 |
Time now = Simulator::Now (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
749 |
double fbTx = now.GetSeconds (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
750 |
double lbTx = (now + txTime).GetSeconds (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
751 |
double fbRx = (now + rxTime - txTime).GetSeconds (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
752 |
double lbRx = (now + rxTime).GetSeconds (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
753 |
CheckMaxPktsPerTraceFile (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
754 |
WriteXmlP ("p", |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
755 |
tx->GetNode ()->GetId (), |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
756 |
fbTx, |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
757 |
lbTx, |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
758 |
rx->GetNode ()->GetId (), |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
759 |
fbRx, |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
760 |
lbRx, |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
761 |
m_enablePacketMetadata? GetPacketMetadata (p):""); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
762 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
763 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
764 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
765 |
AnimationInterface::UanPhyGenTxTrace (std::string context, Ptr<const Packet> p) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
766 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
767 |
if (!m_started || !IsInTimeWindow () || !m_trackPackets) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
768 |
return; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
769 |
Ptr <NetDevice> ndev = GetNetDeviceFromContext (context); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
770 |
NS_ASSERT (ndev); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
771 |
Ptr <Node> n = ndev->GetNode (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
772 |
NS_ASSERT (n); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
773 |
++gAnimUid; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
774 |
NS_LOG_INFO ("Uan TxBeginTrace for packet:" << gAnimUid); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
775 |
AddByteTag (gAnimUid, p); |
11336
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
776 |
UpdatePosition (n); |
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
777 |
AnimPacketInfo pktInfo (ndev, Simulator::Now ()); |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
778 |
AddPendingPacket (AnimationInterface::UAN, gAnimUid, pktInfo); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
779 |
OutputWirelessPacketTxInfo (p, m_pendingUanPackets[gAnimUid], gAnimUid); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
780 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
781 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
782 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
783 |
AnimationInterface::UanPhyGenRxTrace (std::string context, Ptr<const Packet> p) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
784 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
785 |
if (!m_started || !IsInTimeWindow () || !m_trackPackets) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
786 |
return; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
787 |
Ptr <NetDevice> ndev = GetNetDeviceFromContext (context); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
788 |
NS_ASSERT (ndev); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
789 |
Ptr <Node> n = ndev->GetNode (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
790 |
NS_ASSERT (n); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
791 |
uint64_t animUid = GetAnimUidFromPacket (p); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
792 |
NS_LOG_INFO ("UanPhyGenRxTrace for packet:" << animUid); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
793 |
if (!IsPacketPending (animUid, AnimationInterface::UAN)) |
9246
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
794 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
795 |
NS_LOG_WARN ("UanPhyGenRxBeginTrace: unknown Uid"); |
9246
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
796 |
return; |
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
797 |
} |
11336
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
798 |
UpdatePosition (n); |
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
799 |
m_pendingUanPackets[animUid].ProcessRxBegin (ndev, Simulator::Now ().GetSeconds ()); |
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
800 |
OutputWirelessPacketRxInfo (p, m_pendingUanPackets[animUid], animUid); |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
801 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
802 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
803 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
804 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
805 |
AnimationInterface::WifiPhyTxBeginTrace (std::string context, |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
806 |
Ptr<const Packet> p) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
807 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
808 |
if (!m_started || !IsInTimeWindow () || !m_trackPackets) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
809 |
return; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
810 |
Ptr <NetDevice> ndev = GetNetDeviceFromContext (context); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
811 |
NS_ASSERT (ndev); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
812 |
Ptr <Node> n = ndev->GetNode (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
813 |
NS_ASSERT (n); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
814 |
++gAnimUid; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
815 |
NS_LOG_INFO ("Wifi TxBeginTrace for packet:" << gAnimUid); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
816 |
AddByteTag (gAnimUid, p); |
11336
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
817 |
UpdatePosition (n); |
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
818 |
AnimPacketInfo pktInfo (ndev, Simulator::Now ()); |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
819 |
AddPendingPacket (AnimationInterface::WIFI, gAnimUid, pktInfo); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
820 |
Ptr<WifiNetDevice> netDevice = DynamicCast<WifiNetDevice> (ndev); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
821 |
Mac48Address nodeAddr = netDevice->GetMac ()->GetAddress (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
822 |
std::ostringstream oss; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
823 |
oss << nodeAddr; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
824 |
m_macToNodeIdMap[oss.str ()] = n->GetId (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
825 |
NS_LOG_INFO ("Added Mac" << oss.str () << " node:" <<m_macToNodeIdMap[oss.str ()]); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
826 |
OutputWirelessPacketTxInfo (p, m_pendingWifiPackets[gAnimUid], gAnimUid); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
827 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
828 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
829 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
830 |
AnimationInterface::WifiPhyRxBeginTrace (std::string context, |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
831 |
Ptr<const Packet> p) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
832 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
833 |
//NS_LOG_UNCOND ("Context:" << context.c_str ()); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
834 |
if (!m_started || !IsInTimeWindow () || !m_trackPackets) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
835 |
return; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
836 |
Ptr <NetDevice> ndev = GetNetDeviceFromContext (context); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
837 |
NS_ASSERT (ndev); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
838 |
Ptr <Node> n = ndev->GetNode (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
839 |
NS_ASSERT (n); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
840 |
uint64_t animUid = GetAnimUidFromPacket (p); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
841 |
NS_LOG_INFO ("Wifi RxBeginTrace for packet:" << animUid); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
842 |
if (!IsPacketPending (animUid, AnimationInterface::WIFI)) |
9246
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
843 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
844 |
NS_ASSERT (0); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
845 |
NS_LOG_WARN ("WifiPhyRxBeginTrace: unknown Uid"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
846 |
std::ostringstream oss; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
847 |
WifiMacHeader hdr; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
848 |
if (!p->PeekHeader (hdr)) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
849 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
850 |
NS_LOG_WARN ("WifiMacHeader not present"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
851 |
return; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
852 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
853 |
oss << hdr.GetAddr2 (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
854 |
if (m_macToNodeIdMap.find (oss.str ()) == m_macToNodeIdMap.end ()) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
855 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
856 |
NS_LOG_WARN ("Transmitter Mac address " << oss.str () << " never seen before. Skipping"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
857 |
return; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
858 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
859 |
Ptr <Node> txNode = NodeList::GetNode (m_macToNodeIdMap[oss.str ()]); |
11336
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
860 |
UpdatePosition (txNode); |
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
861 |
AnimPacketInfo pktInfo (0, Simulator::Now (), m_macToNodeIdMap[oss.str ()]); |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
862 |
AddPendingPacket (AnimationInterface::WIFI, animUid, pktInfo); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
863 |
NS_LOG_WARN ("WifiPhyRxBegin: unknown Uid, but we are adding a wifi packet"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
864 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
865 |
/// \todo NS_ASSERT (WifiPacketIsPending (animUid) == true); |
11336
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
866 |
UpdatePosition (n); |
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
867 |
m_pendingWifiPackets[animUid].ProcessRxBegin (ndev, Simulator::Now ().GetSeconds ()); |
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
868 |
OutputWirelessPacketRxInfo (p, m_pendingWifiPackets[animUid], animUid); |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
869 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
870 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
871 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
872 |
AnimationInterface::WimaxTxTrace (std::string context, Ptr<const Packet> p, const Mac48Address & m) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
873 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
874 |
if (!m_started || !IsInTimeWindow () || !m_trackPackets) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
875 |
return; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
876 |
Ptr <NetDevice> ndev = GetNetDeviceFromContext (context); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
877 |
NS_ASSERT (ndev); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
878 |
Ptr <Node> n = ndev->GetNode (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
879 |
NS_ASSERT (n); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
880 |
++gAnimUid; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
881 |
NS_LOG_INFO ("WimaxTxTrace for packet:" << gAnimUid); |
11336
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
882 |
UpdatePosition (n); |
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
883 |
AnimPacketInfo pktInfo (ndev, Simulator::Now ()); |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
884 |
AddByteTag (gAnimUid, p); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
885 |
AddPendingPacket (AnimationInterface::WIMAX, gAnimUid, pktInfo); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
886 |
OutputWirelessPacketTxInfo (p, pktInfo, gAnimUid); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
887 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
888 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
889 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
890 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
891 |
AnimationInterface::WimaxRxTrace (std::string context, Ptr<const Packet> p, const Mac48Address & m) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
892 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
893 |
if (!m_started || !IsInTimeWindow () || !m_trackPackets) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
894 |
return; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
895 |
Ptr <NetDevice> ndev = GetNetDeviceFromContext (context); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
896 |
NS_ASSERT (ndev); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
897 |
Ptr <Node> n = ndev->GetNode (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
898 |
NS_ASSERT (n); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
899 |
uint64_t animUid = GetAnimUidFromPacket (p); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
900 |
NS_LOG_INFO ("WimaxRxTrace for packet:" << animUid); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
901 |
NS_ASSERT (IsPacketPending (animUid, AnimationInterface::WIMAX) == true); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
902 |
AnimPacketInfo& pktInfo = m_pendingWimaxPackets[animUid]; |
11336
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
903 |
UpdatePosition (n); |
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
904 |
pktInfo.ProcessRxBegin (ndev, Simulator::Now ().GetSeconds ()); |
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
905 |
OutputWirelessPacketRxInfo (p, pktInfo, animUid); |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
906 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
907 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
908 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
909 |
AnimationInterface::LteTxTrace (std::string context, Ptr<const Packet> p, const Mac48Address & m) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
910 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
911 |
if (!m_started || !IsInTimeWindow () || !m_trackPackets) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
912 |
return; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
913 |
Ptr <NetDevice> ndev = GetNetDeviceFromContext (context); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
914 |
NS_ASSERT (ndev); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
915 |
Ptr <Node> n = ndev->GetNode (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
916 |
NS_ASSERT (n); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
917 |
++gAnimUid; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
918 |
NS_LOG_INFO ("LteTxTrace for packet:" << gAnimUid); |
11336
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
919 |
UpdatePosition (n); |
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
920 |
AnimPacketInfo pktInfo (ndev, Simulator::Now ()); |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
921 |
AddByteTag (gAnimUid, p); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
922 |
AddPendingPacket (AnimationInterface::LTE, gAnimUid, pktInfo); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
923 |
OutputWirelessPacketTxInfo (p, pktInfo, gAnimUid); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
924 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
925 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
926 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
927 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
928 |
AnimationInterface::LteRxTrace (std::string context, Ptr<const Packet> p, const Mac48Address & m) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
929 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
930 |
if (!m_started || !IsInTimeWindow () || !m_trackPackets) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
931 |
return; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
932 |
Ptr <NetDevice> ndev = GetNetDeviceFromContext (context); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
933 |
NS_ASSERT (ndev); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
934 |
Ptr <Node> n = ndev->GetNode (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
935 |
NS_ASSERT (n); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
936 |
uint64_t animUid = GetAnimUidFromPacket (p); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
937 |
NS_LOG_INFO ("LteRxTrace for packet:" << gAnimUid); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
938 |
if (!IsPacketPending (animUid, AnimationInterface::LTE)) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
939 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
940 |
NS_LOG_WARN ("LteRxTrace: unknown Uid"); |
9246
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
941 |
return; |
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
942 |
} |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
943 |
AnimPacketInfo& pktInfo = m_pendingLtePackets[animUid]; |
11336
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
944 |
UpdatePosition (n); |
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
945 |
pktInfo.ProcessRxBegin (ndev, Simulator::Now ().GetSeconds ()); |
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
946 |
OutputWirelessPacketRxInfo (p, pktInfo, animUid); |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
947 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
948 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
949 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
950 |
AnimationInterface::LteSpectrumPhyTxStart (std::string context, Ptr<const PacketBurst> pb) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
951 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
952 |
if (!m_started || !IsInTimeWindow () || !m_trackPackets) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
953 |
return; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
954 |
if (!pb) |
9246
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
955 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
956 |
NS_LOG_WARN ("pb == 0. Not yet supported"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
957 |
return; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
958 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
959 |
context = "/" + context; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
960 |
Ptr <NetDevice> ndev = GetNetDeviceFromContext (context); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
961 |
NS_ASSERT (ndev); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
962 |
Ptr <Node> n = ndev->GetNode (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
963 |
NS_ASSERT (n); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
964 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
965 |
std::list <Ptr <Packet> > pbList = pb->GetPackets (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
966 |
for (std::list <Ptr <Packet> >::iterator i = pbList.begin (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
967 |
i != pbList.end (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
968 |
++i) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
969 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
970 |
Ptr <Packet> p = *i; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
971 |
++gAnimUid; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
972 |
NS_LOG_INFO ("LteSpectrumPhyTxTrace for packet:" << gAnimUid); |
11336
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
973 |
UpdatePosition (n); |
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
974 |
AnimPacketInfo pktInfo (ndev, Simulator::Now ()); |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
975 |
AddByteTag (gAnimUid, p); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
976 |
AddPendingPacket (AnimationInterface::LTE, gAnimUid, pktInfo); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
977 |
OutputWirelessPacketTxInfo (p, pktInfo, gAnimUid); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
978 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
979 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
980 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
981 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
982 |
AnimationInterface::LteSpectrumPhyRxStart (std::string context, Ptr<const PacketBurst> pb) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
983 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
984 |
if (!m_started || !IsInTimeWindow () || !m_trackPackets) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
985 |
return; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
986 |
if (!pb) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
987 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
988 |
NS_LOG_WARN ("pb == 0. Not yet supported"); |
9246
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
989 |
return; |
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
990 |
} |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
991 |
context = "/" + context; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
992 |
Ptr <NetDevice> ndev = GetNetDeviceFromContext (context); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
993 |
NS_ASSERT (ndev); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
994 |
Ptr <Node> n = ndev->GetNode (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
995 |
NS_ASSERT (n); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
996 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
997 |
std::list <Ptr <Packet> > pbList = pb->GetPackets (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
998 |
for (std::list <Ptr <Packet> >::iterator i = pbList.begin (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
999 |
i != pbList.end (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1000 |
++i) |
9246
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1001 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1002 |
Ptr <Packet> p = *i; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1003 |
uint64_t animUid = GetAnimUidFromPacket (p); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1004 |
NS_LOG_INFO ("LteSpectrumPhyRxTrace for packet:" << gAnimUid); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1005 |
if (!IsPacketPending (animUid, AnimationInterface::LTE)) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1006 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1007 |
NS_LOG_WARN ("LteSpectrumPhyRxTrace: unknown Uid"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1008 |
return; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1009 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1010 |
AnimPacketInfo& pktInfo = m_pendingLtePackets[animUid]; |
11336
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
1011 |
UpdatePosition (n); |
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
1012 |
pktInfo.ProcessRxBegin (ndev, Simulator::Now ().GetSeconds ()); |
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
1013 |
OutputWirelessPacketRxInfo (p, pktInfo, animUid); |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1014 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1015 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1016 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1017 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1018 |
AnimationInterface::CsmaPhyTxBeginTrace (std::string context, Ptr<const Packet> p) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1019 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1020 |
if (!m_started || !IsInTimeWindow () || !m_trackPackets) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1021 |
return; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1022 |
Ptr <NetDevice> ndev = GetNetDeviceFromContext (context); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1023 |
NS_ASSERT (ndev); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1024 |
Ptr <Node> n = ndev->GetNode (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1025 |
NS_ASSERT (n); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1026 |
++gAnimUid; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1027 |
NS_LOG_INFO ("CsmaPhyTxBeginTrace for packet:" << gAnimUid); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1028 |
AddByteTag (gAnimUid, p); |
11336
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
1029 |
UpdatePosition (n); |
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
1030 |
AnimPacketInfo pktInfo (ndev, Simulator::Now ()); |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1031 |
AddPendingPacket (AnimationInterface::CSMA, gAnimUid, pktInfo); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1032 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1033 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1034 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1035 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1036 |
AnimationInterface::CsmaPhyTxEndTrace (std::string context, Ptr<const Packet> p) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1037 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1038 |
if (!m_started || !IsInTimeWindow () || !m_trackPackets) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1039 |
return; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1040 |
Ptr <NetDevice> ndev = GetNetDeviceFromContext (context); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1041 |
NS_ASSERT (ndev); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1042 |
Ptr <Node> n = ndev->GetNode (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1043 |
NS_ASSERT (n); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1044 |
uint64_t animUid = GetAnimUidFromPacket (p); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1045 |
NS_LOG_INFO ("CsmaPhyTxEndTrace for packet:" << animUid); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1046 |
if (!IsPacketPending (animUid, AnimationInterface::CSMA)) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1047 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1048 |
NS_LOG_WARN ("CsmaPhyTxEndTrace: unknown Uid"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1049 |
NS_FATAL_ERROR ("CsmaPhyTxEndTrace: unknown Uid"); |
11336
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
1050 |
UpdatePosition (n); |
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
1051 |
AnimPacketInfo pktInfo (ndev, Simulator::Now ()); |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1052 |
AddPendingPacket (AnimationInterface::CSMA, animUid, pktInfo); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1053 |
NS_LOG_WARN ("Unknown Uid, but adding Csma Packet anyway"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1054 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1055 |
/// \todo NS_ASSERT (IsPacketPending (AnimUid) == true); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1056 |
AnimPacketInfo& pktInfo = m_pendingCsmaPackets[animUid]; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1057 |
pktInfo.m_lbTx = Simulator::Now ().GetSeconds (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1058 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1059 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1060 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1061 |
AnimationInterface::CsmaPhyRxEndTrace (std::string context, Ptr<const Packet> p) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1062 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1063 |
if (!m_started || !IsInTimeWindow () || !m_trackPackets) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1064 |
return; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1065 |
Ptr <NetDevice> ndev = GetNetDeviceFromContext (context); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1066 |
NS_ASSERT (ndev); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1067 |
Ptr <Node> n = ndev->GetNode (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1068 |
NS_ASSERT (n); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1069 |
uint64_t animUid = GetAnimUidFromPacket (p); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1070 |
if (!IsPacketPending (animUid, AnimationInterface::CSMA)) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1071 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1072 |
NS_LOG_WARN ("CsmaPhyRxEndTrace: unknown Uid"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1073 |
return; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1074 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1075 |
/// \todo NS_ASSERT (CsmaPacketIsPending (AnimUid) == true); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1076 |
AnimPacketInfo& pktInfo = m_pendingCsmaPackets[animUid]; |
11336
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
1077 |
UpdatePosition (n); |
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
1078 |
pktInfo.ProcessRxBegin (ndev, Simulator::Now ().GetSeconds ()); |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1079 |
NS_LOG_INFO ("CsmaPhyRxEndTrace for packet:" << animUid); |
11336
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
1080 |
NS_LOG_INFO ("CsmaPhyRxEndTrace for packet:" << animUid << " complete"); |
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
1081 |
OutputCsmaPacket (p, pktInfo); |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1082 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1083 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1084 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1085 |
AnimationInterface::CsmaMacRxTrace (std::string context, |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1086 |
Ptr<const Packet> p) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1087 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1088 |
if (!m_started || !IsInTimeWindow () || !m_trackPackets) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1089 |
return; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1090 |
NS_LOG_FUNCTION (this); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1091 |
Ptr <NetDevice> ndev = GetNetDeviceFromContext (context); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1092 |
NS_ASSERT (ndev); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1093 |
Ptr <Node> n = ndev->GetNode (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1094 |
NS_ASSERT (n); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1095 |
uint64_t animUid = GetAnimUidFromPacket (p); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1096 |
if (!IsPacketPending (animUid, AnimationInterface::CSMA)) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1097 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1098 |
NS_LOG_WARN ("CsmaMacRxTrace: unknown Uid"); |
9246
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1099 |
return; |
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1100 |
} |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1101 |
/// \todo NS_ASSERT (CsmaPacketIsPending (AnimUid) == true); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1102 |
AnimPacketInfo& pktInfo = m_pendingCsmaPackets[animUid]; |
11336
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
1103 |
NS_LOG_INFO ("MacRxTrace for packet:" << animUid << " complete"); |
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
1104 |
OutputCsmaPacket (p, pktInfo); |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1105 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1106 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1107 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1108 |
AnimationInterface::OutputWirelessPacketTxInfo (Ptr<const Packet> p, AnimPacketInfo &pktInfo, uint64_t animUid) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1109 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1110 |
CheckMaxPktsPerTraceFile (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1111 |
uint32_t nodeId = 0; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1112 |
if (pktInfo.m_txnd) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1113 |
nodeId = pktInfo.m_txnd->GetNode ()->GetId (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1114 |
else |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1115 |
nodeId = pktInfo.m_txNodeId; |
11336
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
1116 |
WriteXmlPRef (animUid, nodeId, pktInfo.m_fbTx, m_enablePacketMetadata? GetPacketMetadata (p):""); |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1117 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1118 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1119 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1120 |
void |
11336
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
1121 |
AnimationInterface::OutputWirelessPacketRxInfo (Ptr<const Packet> p, AnimPacketInfo & pktInfo, uint64_t animUid) |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1122 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1123 |
CheckMaxPktsPerTraceFile (); |
11336
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
1124 |
uint32_t rxId = pktInfo.m_rxnd->GetNode ()->GetId (); |
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
1125 |
WriteXmlP (animUid, "wpr", rxId, pktInfo.m_fbRx, pktInfo.m_lbRx); |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1126 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1127 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1128 |
void |
11336
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
1129 |
AnimationInterface::OutputCsmaPacket (Ptr<const Packet> p, AnimPacketInfo &pktInfo) |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1130 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1131 |
CheckMaxPktsPerTraceFile (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1132 |
NS_ASSERT (pktInfo.m_txnd); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1133 |
uint32_t nodeId = pktInfo.m_txnd->GetNode ()->GetId (); |
11336
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
1134 |
uint32_t rxId = pktInfo.m_rxnd->GetNode ()->GetId (); |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1135 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1136 |
WriteXmlP ("p", |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1137 |
nodeId, |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1138 |
pktInfo.m_fbTx, |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1139 |
pktInfo.m_lbTx, |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1140 |
rxId, |
11336
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
1141 |
pktInfo.m_fbRx, |
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
1142 |
pktInfo.m_lbRx, |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1143 |
m_enablePacketMetadata? GetPacketMetadata (p):""); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1144 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1145 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1146 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1147 |
AnimationInterface::AddPendingPacket (ProtocolType protocolType, uint64_t animUid, AnimPacketInfo pktInfo) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1148 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1149 |
AnimUidPacketInfoMap * pendingPackets = ProtocolTypeToPendingPackets (protocolType); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1150 |
NS_ASSERT (pendingPackets); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1151 |
pendingPackets->insert (AnimUidPacketInfoMap::value_type (animUid, pktInfo)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1152 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1153 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1154 |
bool |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1155 |
AnimationInterface::IsPacketPending (uint64_t animUid, AnimationInterface::ProtocolType protocolType) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1156 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1157 |
AnimUidPacketInfoMap * pendingPackets = ProtocolTypeToPendingPackets (protocolType); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1158 |
NS_ASSERT (pendingPackets); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1159 |
return (pendingPackets->find (animUid) != pendingPackets->end ()); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1160 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1161 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1162 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1163 |
AnimationInterface::PurgePendingPackets (AnimationInterface::ProtocolType protocolType) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1164 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1165 |
AnimUidPacketInfoMap * pendingPackets = ProtocolTypeToPendingPackets (protocolType); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1166 |
NS_ASSERT (pendingPackets); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1167 |
if (pendingPackets->empty ()) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1168 |
return; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1169 |
std::vector <uint64_t> purgeList; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1170 |
for (AnimUidPacketInfoMap::iterator i = pendingPackets->begin (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1171 |
i != pendingPackets->end (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1172 |
++i) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1173 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1174 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1175 |
AnimPacketInfo pktInfo = i->second; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1176 |
double delta = (Simulator::Now ().GetSeconds () - pktInfo.m_fbTx); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1177 |
if (delta > PURGE_INTERVAL) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1178 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1179 |
purgeList.push_back (i->first); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1180 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1181 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1182 |
for (std::vector <uint64_t>::iterator i = purgeList.begin (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1183 |
i != purgeList.end (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1184 |
++i) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1185 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1186 |
pendingPackets->erase (*i); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1187 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1188 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1189 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1190 |
AnimationInterface::AnimUidPacketInfoMap * |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1191 |
AnimationInterface::ProtocolTypeToPendingPackets (AnimationInterface::ProtocolType protocolType) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1192 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1193 |
AnimUidPacketInfoMap * pendingPackets = 0; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1194 |
switch (protocolType) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1195 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1196 |
case AnimationInterface::WIFI: |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1197 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1198 |
pendingPackets = &m_pendingWifiPackets; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1199 |
break; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1200 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1201 |
case AnimationInterface::UAN: |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1202 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1203 |
pendingPackets = &m_pendingUanPackets; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1204 |
break; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1205 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1206 |
case AnimationInterface::CSMA: |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1207 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1208 |
pendingPackets = &m_pendingCsmaPackets; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1209 |
break; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1210 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1211 |
case AnimationInterface::WIMAX: |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1212 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1213 |
pendingPackets = &m_pendingWimaxPackets; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1214 |
break; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1215 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1216 |
case AnimationInterface::LTE: |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1217 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1218 |
pendingPackets = &m_pendingLtePackets; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1219 |
break; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1220 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1221 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1222 |
return pendingPackets; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1223 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1224 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1225 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1226 |
// Counters |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1227 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1228 |
std::string |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1229 |
AnimationInterface::CounterTypeToString (CounterType counterType) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1230 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1231 |
std::string typeString = "unknown"; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1232 |
switch (counterType) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1233 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1234 |
case UINT32_COUNTER: |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1235 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1236 |
typeString = "UINT32"; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1237 |
break; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1238 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1239 |
case DOUBLE_COUNTER: |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1240 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1241 |
typeString = "DOUBLE"; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1242 |
break; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1243 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1244 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1245 |
return typeString; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1246 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1247 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1248 |
// General |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1249 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1250 |
std::string |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1251 |
AnimationInterface::GetPacketMetadata (Ptr<const Packet> p) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1252 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1253 |
std::ostringstream oss; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1254 |
p->Print (oss); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1255 |
return oss.str (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1256 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1257 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1258 |
uint64_t |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1259 |
AnimationInterface::GetTracePktCount () |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1260 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1261 |
return m_currentPktCount; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1262 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1263 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1264 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1265 |
AnimationInterface::StopAnimation (bool onlyAnimation) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1266 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1267 |
m_started = false; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1268 |
NS_LOG_INFO ("Stopping Animation"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1269 |
ResetAnimWriteCallback (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1270 |
if (m_f) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1271 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1272 |
// Terminate the anim element |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1273 |
WriteXmlClose ("anim"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1274 |
std::fclose (m_f); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1275 |
m_f = 0; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1276 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1277 |
if (onlyAnimation) |
9246
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1278 |
{ |
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1279 |
return; |
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1280 |
} |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1281 |
if (m_routingF) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1282 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1283 |
WriteXmlClose ("anim", true); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1284 |
std::fclose (m_routingF); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1285 |
m_routingF = 0; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1286 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1287 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1288 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1289 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1290 |
AnimationInterface::StartAnimation (bool restart) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1291 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1292 |
m_currentPktCount = 0; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1293 |
m_started = true; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1294 |
SetOutputFile (m_outputFileName); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1295 |
WriteXmlAnim (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1296 |
WriteNodes (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1297 |
WriteNodeColors (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1298 |
WriteLinkProperties (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1299 |
WriteNodeSizes (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1300 |
WriteNodeEnergies (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1301 |
if (!restart) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1302 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1303 |
Simulator::Schedule (m_mobilityPollInterval, &AnimationInterface::MobilityAutoCheck, this); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1304 |
ConnectCallbacks (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1305 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1306 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1307 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1308 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1309 |
AnimationInterface::AddToIpv4AddressNodeIdTable (std::string ipv4Address, uint32_t nodeId) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1310 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1311 |
m_ipv4ToNodeIdMap[ipv4Address] = nodeId; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1312 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1313 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1314 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1315 |
// Callbacks |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1316 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1317 |
AnimationInterface::ConnectLteEnb (Ptr <Node> n, Ptr <LteEnbNetDevice> nd, uint32_t devIndex) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1318 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1319 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1320 |
Ptr<LteEnbPhy> lteEnbPhy = nd->GetPhy (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1321 |
Ptr<LteSpectrumPhy> dlPhy = lteEnbPhy->GetDownlinkSpectrumPhy (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1322 |
Ptr<LteSpectrumPhy> ulPhy = lteEnbPhy->GetUplinkSpectrumPhy (); |
9246
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1323 |
std::ostringstream oss; |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1324 |
//NodeList/*/DeviceList/*/ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1325 |
oss << "NodeList/" << n->GetId () << "/DeviceList/" << devIndex << "/"; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1326 |
if (dlPhy) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1327 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1328 |
dlPhy->TraceConnect ("TxStart", oss.str (), MakeCallback (&AnimationInterface::LteSpectrumPhyTxStart, this)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1329 |
dlPhy->TraceConnect ("RxStart", oss.str (), MakeCallback (&AnimationInterface::LteSpectrumPhyRxStart, this)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1330 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1331 |
if (ulPhy) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1332 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1333 |
ulPhy->TraceConnect ("TxStart", oss.str (), MakeCallback (&AnimationInterface::LteSpectrumPhyTxStart, this)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1334 |
ulPhy->TraceConnect ("RxStart", oss.str (), MakeCallback (&AnimationInterface::LteSpectrumPhyRxStart, this)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1335 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1336 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1337 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1338 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1339 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1340 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1341 |
AnimationInterface::ConnectLteUe (Ptr <Node> n, Ptr <LteUeNetDevice> nd, uint32_t devIndex) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1342 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1343 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1344 |
Ptr<LteUePhy> lteUePhy = nd->GetPhy (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1345 |
Ptr<LteSpectrumPhy> dlPhy = lteUePhy->GetDownlinkSpectrumPhy (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1346 |
Ptr<LteSpectrumPhy> ulPhy = lteUePhy->GetUplinkSpectrumPhy (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1347 |
std::ostringstream oss; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1348 |
//NodeList/*/DeviceList/*/ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1349 |
oss << "NodeList/" << n->GetId () << "/DeviceList/" << devIndex << "/"; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1350 |
if (dlPhy) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1351 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1352 |
dlPhy->TraceConnect ("TxStart", oss.str (), MakeCallback (&AnimationInterface::LteSpectrumPhyTxStart, this)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1353 |
dlPhy->TraceConnect ("RxStart", oss.str (), MakeCallback (&AnimationInterface::LteSpectrumPhyRxStart, this)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1354 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1355 |
if (ulPhy) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1356 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1357 |
ulPhy->TraceConnect ("TxStart", oss.str (), MakeCallback (&AnimationInterface::LteSpectrumPhyTxStart, this)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1358 |
ulPhy->TraceConnect ("RxStart", oss.str (), MakeCallback (&AnimationInterface::LteSpectrumPhyRxStart, this)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1359 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1360 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1361 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1362 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1363 |
AnimationInterface::ConnectLte () |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1364 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1365 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1366 |
for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); ++i) |
9246
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1367 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1368 |
Ptr<Node> n = *i; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1369 |
NS_ASSERT (n); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1370 |
uint32_t nDevices = n->GetNDevices (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1371 |
for (uint32_t devIndex = 0; devIndex < nDevices; ++devIndex) |
9247
740c45821021
NetAnim: Implement route path element XML tag
John Abraham <john.abraham.in@gmail.com>
parents:
9246
diff
changeset
|
1372 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1373 |
Ptr <NetDevice> nd = n->GetDevice (devIndex); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1374 |
if (!nd) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1375 |
continue; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1376 |
Ptr<LteUeNetDevice> lteUeNetDevice = DynamicCast<LteUeNetDevice> (nd); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1377 |
if (lteUeNetDevice) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1378 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1379 |
ConnectLteUe (n, lteUeNetDevice, devIndex); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1380 |
continue; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1381 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1382 |
Ptr<LteEnbNetDevice> lteEnbNetDevice = DynamicCast<LteEnbNetDevice> (nd); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1383 |
if (lteEnbNetDevice) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1384 |
ConnectLteEnb (n, lteEnbNetDevice, devIndex); |
9247
740c45821021
NetAnim: Implement route path element XML tag
John Abraham <john.abraham.in@gmail.com>
parents:
9246
diff
changeset
|
1385 |
} |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1386 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1387 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1388 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1389 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1390 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1391 |
AnimationInterface::ConnectCallbacks () |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1392 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1393 |
// Connect the callbacks |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1394 |
Config::Connect ("/ChannelList/*/TxRxPointToPoint", |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1395 |
MakeCallback (&AnimationInterface::DevTxTrace, this)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1396 |
Config::Connect ("NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyTxBegin", |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1397 |
MakeCallback (&AnimationInterface::WifiPhyTxBeginTrace, this)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1398 |
Config::Connect ("NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyRxBegin", |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1399 |
MakeCallback (&AnimationInterface::WifiPhyRxBeginTrace, this)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1400 |
Config::ConnectWithoutContext ("/NodeList/*/$ns3::MobilityModel/CourseChange", |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1401 |
MakeCallback (&AnimationInterface::MobilityCourseChangeTrace, this)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1402 |
Config::Connect ("/NodeList/*/DeviceList/*/$ns3::WimaxNetDevice/Tx", |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1403 |
MakeCallback (&AnimationInterface::WimaxTxTrace, this)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1404 |
Config::Connect ("/NodeList/*/DeviceList/*/$ns3::WimaxNetDevice/Rx", |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1405 |
MakeCallback (&AnimationInterface::WimaxRxTrace, this)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1406 |
Config::Connect ("/NodeList/*/DeviceList/*/$ns3::LteNetDevice/Tx", |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1407 |
MakeCallback (&AnimationInterface::LteTxTrace, this)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1408 |
Config::Connect ("/NodeList/*/DeviceList/*/$ns3::LteNetDevice/Rx", |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1409 |
MakeCallback (&AnimationInterface::LteRxTrace, this)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1410 |
Config::Connect ("/NodeList/*/DeviceList/*/$ns3::CsmaNetDevice/PhyTxBegin", |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1411 |
MakeCallback (&AnimationInterface::CsmaPhyTxBeginTrace, this)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1412 |
Config::Connect ("/NodeList/*/DeviceList/*/$ns3::CsmaNetDevice/PhyTxEnd", |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1413 |
MakeCallback (&AnimationInterface::CsmaPhyTxEndTrace, this)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1414 |
Config::Connect ("/NodeList/*/DeviceList/*/$ns3::CsmaNetDevice/PhyRxEnd", |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1415 |
MakeCallback (&AnimationInterface::CsmaPhyRxEndTrace, this)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1416 |
Config::Connect ("/NodeList/*/DeviceList/*/$ns3::CsmaNetDevice/MacRx", |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1417 |
MakeCallback (&AnimationInterface::CsmaMacRxTrace, this)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1418 |
Config::Connect ("/NodeList/*/DeviceList/*/$ns3::UanNetDevice/Phy/PhyTxBegin", |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1419 |
MakeCallback (&AnimationInterface::UanPhyGenTxTrace, this)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1420 |
Config::Connect ("/NodeList/*/DeviceList/*/$ns3::UanNetDevice/Phy/PhyRxBegin", |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1421 |
MakeCallback (&AnimationInterface::UanPhyGenRxTrace, this)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1422 |
Config::Connect ("/NodeList/*/$ns3::BasicEnergySource/RemainingEnergy", |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1423 |
MakeCallback (&AnimationInterface::RemainingEnergyTrace, this)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1424 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1425 |
ConnectLte (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1426 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1427 |
Config::Connect ("/NodeList/*/$ns3::Ipv4L3Protocol/Tx", |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1428 |
MakeCallback (&AnimationInterface::Ipv4TxTrace, this)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1429 |
Config::Connect ("/NodeList/*/$ns3::Ipv4L3Protocol/Rx", |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1430 |
MakeCallback (&AnimationInterface::Ipv4RxTrace, this)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1431 |
Config::Connect ("/NodeList/*/$ns3::Ipv4L3Protocol/Drop", |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1432 |
MakeCallback (&AnimationInterface::Ipv4DropTrace, this)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1433 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1434 |
// Queue Enqueues |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1435 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1436 |
Config::Connect ("/NodeList/*/DeviceList/*/$ns3::AlohaNoackNetDevice/Queue/Enqueue", |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1437 |
MakeCallback (&AnimationInterface::EnqueueTrace, this)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1438 |
Config::Connect ("/NodeList/*/DeviceList/*/$ns3::CsmaNetDevice/TxQueue/Enqueue", |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1439 |
MakeCallback (&AnimationInterface::EnqueueTrace, this)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1440 |
Config::Connect ("/NodeList/*/DeviceList/*/$ns3::PointToPointNetDevice/TxQueue/Enqueue", |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1441 |
MakeCallback (&AnimationInterface::EnqueueTrace, this)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1442 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1443 |
// Queue Dequeues |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1444 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1445 |
Config::Connect ("/NodeList/*/DeviceList/*/$ns3::AlohaNoackNetDevice/Queue/Dequeue", |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1446 |
MakeCallback (&AnimationInterface::DequeueTrace, this)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1447 |
Config::Connect ("/NodeList/*/DeviceList/*/$ns3::CsmaNetDevice/TxQueue/Dequeue", |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1448 |
MakeCallback (&AnimationInterface::DequeueTrace, this)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1449 |
Config::Connect ("/NodeList/*/DeviceList/*/$ns3::PointToPointNetDevice/TxQueue/Dequeue", |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1450 |
MakeCallback (&AnimationInterface::DequeueTrace, this)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1451 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1452 |
// Queue Drops |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1453 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1454 |
Config::Connect ("/NodeList/*/DeviceList/*/$ns3::AlohaNoackNetDevice/Queue/Drop", |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1455 |
MakeCallback (&AnimationInterface::QueueDropTrace, this)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1456 |
Config::Connect ("/NodeList/*/DeviceList/*/$ns3::CsmaNetDevice/TxQueue/Drop", |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1457 |
MakeCallback (&AnimationInterface::QueueDropTrace, this)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1458 |
Config::Connect ("/NodeList/*/DeviceList/*/$ns3::PointToPointNetDevice/TxQueue/Drop", |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1459 |
MakeCallback (&AnimationInterface::QueueDropTrace, this)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1460 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1461 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1462 |
// Wifi Mac |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1463 |
Config::Connect ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/MacTx", |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1464 |
MakeCallback (&AnimationInterface::WifiMacTxTrace, this)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1465 |
Config::Connect ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/MacTxDrop", |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1466 |
MakeCallback (&AnimationInterface::WifiMacTxDropTrace, this)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1467 |
Config::Connect ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/MacRx", |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1468 |
MakeCallback (&AnimationInterface::WifiMacRxTrace, this)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1469 |
Config::Connect ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/MacRxDrop", |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1470 |
MakeCallback (&AnimationInterface::WifiMacRxDropTrace, this)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1471 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1472 |
// Wifi Phy |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1473 |
Config::Connect ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyTxDrop", |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1474 |
MakeCallback (&AnimationInterface::WifiPhyTxDropTrace, this)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1475 |
Config::Connect ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyRxDrop", |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1476 |
MakeCallback (&AnimationInterface::WifiPhyRxDropTrace, this)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1477 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1478 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1479 |
Vector |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1480 |
AnimationInterface::UpdatePosition (Ptr <Node> n) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1481 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1482 |
Ptr<MobilityModel> loc = n->GetObject<MobilityModel> (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1483 |
if (loc) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1484 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1485 |
m_nodeLocation[n->GetId ()] = loc->GetPosition (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1486 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1487 |
else |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1488 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1489 |
NS_LOG_UNCOND ( "AnimationInterface WARNING:Node:" << n->GetId () << " Does not have a mobility model. Use SetConstantPosition if it is stationary"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1490 |
m_nodeLocation[n->GetId ()] = Vector (0, 0, 0); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1491 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1492 |
return m_nodeLocation[n->GetId ()]; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1493 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1494 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1495 |
Vector |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1496 |
AnimationInterface::UpdatePosition (Ptr <Node> n, Vector v) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1497 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1498 |
m_nodeLocation[n->GetId ()] = v; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1499 |
return v; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1500 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1501 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1502 |
Vector |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1503 |
AnimationInterface::GetPosition (Ptr <Node> n) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1504 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1505 |
if (m_nodeLocation.find (n->GetId ()) == m_nodeLocation.end ()) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1506 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1507 |
NS_FATAL_ERROR ("Node:" <<n->GetId () << " not found in Location table"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1508 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1509 |
return m_nodeLocation[n->GetId ()]; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1510 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1511 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1512 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1513 |
std::string |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1514 |
AnimationInterface::GetMacAddress (Ptr <NetDevice> nd) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1515 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1516 |
Address nodeAddr = nd->GetAddress (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1517 |
std::ostringstream oss; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1518 |
oss << nodeAddr; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1519 |
return oss.str ().substr (6); // Skip the first 6 chars to get the Mac |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1520 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1521 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1522 |
std::string |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1523 |
AnimationInterface::GetIpv4Address (Ptr <NetDevice> nd) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1524 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1525 |
Ptr<Ipv4> ipv4 = NodeList::GetNode (nd->GetNode ()->GetId ())->GetObject <Ipv4> (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1526 |
if (!ipv4) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1527 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1528 |
NS_LOG_WARN ("Node: " << nd->GetNode ()->GetId () << " No ipv4 object found"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1529 |
return "0.0.0.0"; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1530 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1531 |
int32_t ifIndex = ipv4->GetInterfaceForDevice (nd); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1532 |
if (ifIndex == -1) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1533 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1534 |
NS_LOG_WARN ("Node :" << nd->GetNode ()->GetId () << " Could not find index of NetDevice"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1535 |
return "0.0.0.0"; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1536 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1537 |
Ipv4InterfaceAddress addr = ipv4->GetAddress (ifIndex, 0); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1538 |
std::ostringstream oss; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1539 |
oss << addr.GetLocal (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1540 |
return oss.str (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1541 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1542 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1543 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1544 |
AnimationInterface::WriteLinkProperties () |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1545 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1546 |
for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); ++i) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1547 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1548 |
Ptr<Node> n = *i; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1549 |
UpdatePosition (n); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1550 |
uint32_t n1Id = n->GetId (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1551 |
uint32_t nDev = n->GetNDevices (); // Number of devices |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1552 |
for (uint32_t i = 0; i < nDev; ++i) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1553 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1554 |
Ptr<NetDevice> dev = n->GetDevice (i); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1555 |
NS_ASSERT (dev); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1556 |
Ptr<Channel> ch = dev->GetChannel (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1557 |
if (!ch) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1558 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1559 |
NS_LOG_DEBUG ("No channel can't be a p2p device"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1560 |
// Try to see if it is an LTE NetDevice, which does not return a channel |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1561 |
if ((dev->GetInstanceTypeId ().GetName () == "ns3::LteUeNetDevice") || |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1562 |
(dev->GetInstanceTypeId ().GetName () == "ns3::LteEnbNetDevice")|| |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1563 |
(dev->GetInstanceTypeId ().GetName () == "ns3::VirtualNetDevice")) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1564 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1565 |
WriteNonP2pLinkProperties (n->GetId (), GetIpv4Address (dev) + "~" + GetMacAddress (dev), dev->GetInstanceTypeId ().GetName ()); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1566 |
AddToIpv4AddressNodeIdTable (GetIpv4Address (dev), n->GetId ()); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1567 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1568 |
continue; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1569 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1570 |
std::string channelType = ch->GetInstanceTypeId ().GetName (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1571 |
NS_LOG_DEBUG ("Got ChannelType" << channelType); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1572 |
if (channelType == std::string ("ns3::PointToPointChannel")) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1573 |
{ // Since these are duplex links, we only need to dump |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1574 |
// if srcid < dstid |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1575 |
uint32_t nChDev = ch->GetNDevices (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1576 |
for (uint32_t j = 0; j < nChDev; ++j) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1577 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1578 |
Ptr<NetDevice> chDev = ch->GetDevice (j); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1579 |
uint32_t n2Id = chDev->GetNode ()->GetId (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1580 |
if (n1Id < n2Id) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1581 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1582 |
// ouptut the p2p link |
11218
94c2675383e6
Restore link properties for Ipv4 address and mac address
John Abraham
parents:
10968
diff
changeset
|
1583 |
NS_LOG_INFO ("Link:" << GetIpv4Address (dev) << ":" << GetMacAddress (dev) << "----" << GetIpv4Address (chDev) << ":" << GetMacAddress (chDev)); |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1584 |
AddToIpv4AddressNodeIdTable (GetIpv4Address (dev), n1Id); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1585 |
AddToIpv4AddressNodeIdTable (GetIpv4Address (chDev), n2Id); |
11218
94c2675383e6
Restore link properties for Ipv4 address and mac address
John Abraham
parents:
10968
diff
changeset
|
1586 |
P2pLinkNodeIdPair p2pPair; |
94c2675383e6
Restore link properties for Ipv4 address and mac address
John Abraham
parents:
10968
diff
changeset
|
1587 |
p2pPair.fromNode = n1Id; |
94c2675383e6
Restore link properties for Ipv4 address and mac address
John Abraham
parents:
10968
diff
changeset
|
1588 |
p2pPair.toNode = n2Id; |
94c2675383e6
Restore link properties for Ipv4 address and mac address
John Abraham
parents:
10968
diff
changeset
|
1589 |
LinkProperties lp = {GetIpv4Address (dev) + "~" + GetMacAddress (dev), GetIpv4Address (chDev) + "~" + GetMacAddress (chDev), ""}; |
94c2675383e6
Restore link properties for Ipv4 address and mac address
John Abraham
parents:
10968
diff
changeset
|
1590 |
m_linkProperties[p2pPair] = lp; |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1591 |
WriteXmlLink (n1Id, 0, n2Id); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1592 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1593 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1594 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1595 |
else |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1596 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1597 |
NS_LOG_INFO ("Link:" << GetIpv4Address (dev) << " Channel Type:" << channelType << " Mac: " << GetMacAddress (dev)); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1598 |
WriteNonP2pLinkProperties (n->GetId (), GetIpv4Address (dev) + "~" + GetMacAddress (dev), channelType); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1599 |
AddToIpv4AddressNodeIdTable (GetIpv4Address (dev), n->GetId ()); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1600 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1601 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1602 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1603 |
m_linkProperties.clear (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1604 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1605 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1606 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1607 |
AnimationInterface::WriteNodes () |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1608 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1609 |
for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); ++i) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1610 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1611 |
Ptr<Node> n = *i; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1612 |
NS_LOG_INFO ("Update Position for Node: " << n->GetId ()); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1613 |
Vector v = UpdatePosition (n); |
10843
c0075b54818c
NetAnim: Support for system id associated with nodes
Dmitrii Shakshin <d.shakshin@gmail.com>
parents:
10827
diff
changeset
|
1614 |
WriteXmlNode (n->GetId (), n->GetSystemId (), v.x, v.y); |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1615 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1616 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1617 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1618 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1619 |
AnimationInterface::WriteNodeColors () |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1620 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1621 |
for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); ++i) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1622 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1623 |
Ptr<Node> n = *i; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1624 |
Rgb rgb = {255, 0, 0}; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1625 |
if (m_nodeColors.find (n->GetId ()) == m_nodeColors.end ()) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1626 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1627 |
m_nodeColors[n->GetId ()] = rgb; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1628 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1629 |
UpdateNodeColor (n, rgb.r, rgb.g, rgb.b); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1630 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1631 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1632 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1633 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1634 |
AnimationInterface::WriteNodeSizes () |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1635 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1636 |
for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); ++i) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1637 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1638 |
Ptr<Node> n = *i; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1639 |
NS_LOG_INFO ("Update Size for Node: " << n->GetId ()); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1640 |
AnimationInterface::NodeSize s = { 1, 1 }; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1641 |
m_nodeSizes[n->GetId ()] = s; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1642 |
UpdateNodeSize (n->GetId (), s.width, s.height); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1643 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1644 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1645 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1646 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1647 |
AnimationInterface::WriteNodeEnergies () |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1648 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1649 |
m_remainingEnergyCounterId = AddNodeCounter ("RemainingEnergy", AnimationInterface::DOUBLE_COUNTER); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1650 |
for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); ++i) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1651 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1652 |
Ptr<Node> n = *i; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1653 |
if (NodeList::GetNode (n->GetId ())->GetObject<EnergySource> ()) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1654 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1655 |
UpdateNodeCounter (m_remainingEnergyCounterId, n->GetId (), 1); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1656 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1657 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1658 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1659 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1660 |
bool |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1661 |
AnimationInterface::IsInTimeWindow () |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1662 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1663 |
if ((Simulator::Now () >= m_startTime) && |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1664 |
(Simulator::Now () <= m_stopTime)) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1665 |
return true; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1666 |
else |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1667 |
return false; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1668 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1669 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1670 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1671 |
AnimationInterface::SetOutputFile (const std::string& fn, bool routing) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1672 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1673 |
if (!routing && m_f) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1674 |
{ |
9246
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1675 |
return; |
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1676 |
} |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1677 |
if (routing && m_routingF) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1678 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1679 |
NS_FATAL_ERROR ("SetRoutingOutputFile already used once"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1680 |
return; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1681 |
} |
9246
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1682 |
|
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1683 |
NS_LOG_INFO ("Creating new trace file:" << fn.c_str ()); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1684 |
FILE * f = 0; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1685 |
f = std::fopen (fn.c_str (), "w"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1686 |
if (!f) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1687 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1688 |
NS_FATAL_ERROR ("Unable to open output file:" << fn.c_str ()); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1689 |
return; // Can't open output file |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1690 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1691 |
if (routing) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1692 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1693 |
m_routingF = f; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1694 |
m_routingFileName = fn; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1695 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1696 |
else |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1697 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1698 |
m_f = f; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1699 |
m_outputFileName = fn; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1700 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1701 |
return; |
9246
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1702 |
} |
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1703 |
|
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1704 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1705 |
AnimationInterface::CheckMaxPktsPerTraceFile () |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1706 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1707 |
// Start a new trace file if the current packet count exceeded nax packets per file |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1708 |
++m_currentPktCount; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1709 |
if (m_currentPktCount <= m_maxPktsPerFile) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1710 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1711 |
return; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1712 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1713 |
NS_LOG_UNCOND ("Max Packets per trace file exceeded"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1714 |
StopAnimation (true); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1715 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1716 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1717 |
std::string |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1718 |
AnimationInterface::GetNetAnimVersion () |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1719 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1720 |
return NETANIM_VERSION; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1721 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1722 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1723 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1724 |
// Routing |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1725 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1726 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1727 |
AnimationInterface::TrackIpv4RoutePaths () |
9246
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1728 |
{ |
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1729 |
if (m_ipv4RouteTrackElements.empty ()) |
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1730 |
{ |
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1731 |
return; |
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1732 |
} |
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1733 |
for (std::vector <Ipv4RouteTrackElement>::const_iterator i = m_ipv4RouteTrackElements.begin (); |
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1734 |
i != m_ipv4RouteTrackElements.end (); |
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1735 |
++i) |
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1736 |
{ |
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1737 |
Ipv4RouteTrackElement trackElement = *i; |
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1738 |
Ptr <Node> fromNode = NodeList::GetNode (trackElement.fromNodeId); |
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1739 |
if (!fromNode) |
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1740 |
{ |
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1741 |
NS_FATAL_ERROR ("Node: " << trackElement.fromNodeId << " Not found"); |
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1742 |
continue; |
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1743 |
} |
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1744 |
Ptr <ns3::Ipv4> ipv4 = fromNode->GetObject <ns3::Ipv4> (); |
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1745 |
if (!ipv4) |
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1746 |
{ |
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1747 |
NS_LOG_WARN ("ipv4 object not found"); |
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1748 |
continue; |
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1749 |
} |
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1750 |
Ptr <Ipv4RoutingProtocol> rp = ipv4->GetRoutingProtocol (); |
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1751 |
if (!rp) |
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1752 |
{ |
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1753 |
NS_LOG_WARN ("Routing protocol object not found"); |
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1754 |
continue; |
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1755 |
} |
9247
740c45821021
NetAnim: Implement route path element XML tag
John Abraham <john.abraham.in@gmail.com>
parents:
9246
diff
changeset
|
1756 |
NS_LOG_INFO ("Begin Track Route for: " << trackElement.destination.c_str () << " From:" << trackElement.fromNodeId); |
9951
992672356bc3
NetAnim: Some RPs want a non-zero Packet for RouteOutput
John Abraham <john.abraham.in@gmail.com>
parents:
9870
diff
changeset
|
1757 |
Ptr<Packet> pkt = Create<Packet> (); |
9246
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1758 |
Ipv4Header header; |
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1759 |
header.SetDestination (Ipv4Address (trackElement.destination.c_str ())); |
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1760 |
Socket::SocketErrno sockerr; |
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1761 |
Ptr <Ipv4Route> rt = rp->RouteOutput (pkt, header, 0, sockerr); |
9961
b47c973edcbb
NetAnim: Missing continue statement when Gateway is missing
John Abraham <john.abraham.in@gmail.com>
parents:
9951
diff
changeset
|
1762 |
Ipv4RoutePathElements rpElements; |
9247
740c45821021
NetAnim: Implement route path element XML tag
John Abraham <john.abraham.in@gmail.com>
parents:
9246
diff
changeset
|
1763 |
if (!rt) |
740c45821021
NetAnim: Implement route path element XML tag
John Abraham <john.abraham.in@gmail.com>
parents:
9246
diff
changeset
|
1764 |
{ |
740c45821021
NetAnim: Implement route path element XML tag
John Abraham <john.abraham.in@gmail.com>
parents:
9246
diff
changeset
|
1765 |
NS_LOG_INFO ("No route to :" << trackElement.destination.c_str ()); |
9961
b47c973edcbb
NetAnim: Missing continue statement when Gateway is missing
John Abraham <john.abraham.in@gmail.com>
parents:
9951
diff
changeset
|
1766 |
Ipv4RoutePathElement elem = { trackElement.fromNodeId, "-1" }; |
b47c973edcbb
NetAnim: Missing continue statement when Gateway is missing
John Abraham <john.abraham.in@gmail.com>
parents:
9951
diff
changeset
|
1767 |
rpElements.push_back (elem); |
b47c973edcbb
NetAnim: Missing continue statement when Gateway is missing
John Abraham <john.abraham.in@gmail.com>
parents:
9951
diff
changeset
|
1768 |
WriteRoutePath (trackElement.fromNodeId, trackElement.destination, rpElements); |
b47c973edcbb
NetAnim: Missing continue statement when Gateway is missing
John Abraham <john.abraham.in@gmail.com>
parents:
9951
diff
changeset
|
1769 |
continue; |
9247
740c45821021
NetAnim: Implement route path element XML tag
John Abraham <john.abraham.in@gmail.com>
parents:
9246
diff
changeset
|
1770 |
} |
9246
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1771 |
std::ostringstream oss; |
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1772 |
oss << rt->GetGateway (); |
9247
740c45821021
NetAnim: Implement route path element XML tag
John Abraham <john.abraham.in@gmail.com>
parents:
9246
diff
changeset
|
1773 |
NS_LOG_INFO ("Node:" << trackElement.fromNodeId << "-->" << rt->GetGateway ()); |
740c45821021
NetAnim: Implement route path element XML tag
John Abraham <john.abraham.in@gmail.com>
parents:
9246
diff
changeset
|
1774 |
if (rt->GetGateway () == "0.0.0.0") |
740c45821021
NetAnim: Implement route path element XML tag
John Abraham <john.abraham.in@gmail.com>
parents:
9246
diff
changeset
|
1775 |
{ |
740c45821021
NetAnim: Implement route path element XML tag
John Abraham <john.abraham.in@gmail.com>
parents:
9246
diff
changeset
|
1776 |
Ipv4RoutePathElement elem = { trackElement.fromNodeId, "C" }; |
740c45821021
NetAnim: Implement route path element XML tag
John Abraham <john.abraham.in@gmail.com>
parents:
9246
diff
changeset
|
1777 |
rpElements.push_back (elem); |
740c45821021
NetAnim: Implement route path element XML tag
John Abraham <john.abraham.in@gmail.com>
parents:
9246
diff
changeset
|
1778 |
if ( m_ipv4ToNodeIdMap.find (trackElement.destination) != m_ipv4ToNodeIdMap.end ()) |
740c45821021
NetAnim: Implement route path element XML tag
John Abraham <john.abraham.in@gmail.com>
parents:
9246
diff
changeset
|
1779 |
{ |
740c45821021
NetAnim: Implement route path element XML tag
John Abraham <john.abraham.in@gmail.com>
parents:
9246
diff
changeset
|
1780 |
Ipv4RoutePathElement elem2 = { m_ipv4ToNodeIdMap[trackElement.destination], "L" }; |
740c45821021
NetAnim: Implement route path element XML tag
John Abraham <john.abraham.in@gmail.com>
parents:
9246
diff
changeset
|
1781 |
rpElements.push_back (elem2); |
740c45821021
NetAnim: Implement route path element XML tag
John Abraham <john.abraham.in@gmail.com>
parents:
9246
diff
changeset
|
1782 |
} |
740c45821021
NetAnim: Implement route path element XML tag
John Abraham <john.abraham.in@gmail.com>
parents:
9246
diff
changeset
|
1783 |
} |
9248
31e5a4b0f1b2
NetAnim: Handle special case for deferred routes
John Abraham <john.abraham.in@gmail.com>
parents:
9247
diff
changeset
|
1784 |
else if (rt->GetGateway () == "127.0.0.1") |
31e5a4b0f1b2
NetAnim: Handle special case for deferred routes
John Abraham <john.abraham.in@gmail.com>
parents:
9247
diff
changeset
|
1785 |
{ |
31e5a4b0f1b2
NetAnim: Handle special case for deferred routes
John Abraham <john.abraham.in@gmail.com>
parents:
9247
diff
changeset
|
1786 |
Ipv4RoutePathElement elem = { trackElement.fromNodeId, "-1" }; |
31e5a4b0f1b2
NetAnim: Handle special case for deferred routes
John Abraham <john.abraham.in@gmail.com>
parents:
9247
diff
changeset
|
1787 |
rpElements.push_back (elem); |
31e5a4b0f1b2
NetAnim: Handle special case for deferred routes
John Abraham <john.abraham.in@gmail.com>
parents:
9247
diff
changeset
|
1788 |
} |
9247
740c45821021
NetAnim: Implement route path element XML tag
John Abraham <john.abraham.in@gmail.com>
parents:
9246
diff
changeset
|
1789 |
else |
740c45821021
NetAnim: Implement route path element XML tag
John Abraham <john.abraham.in@gmail.com>
parents:
9246
diff
changeset
|
1790 |
{ |
740c45821021
NetAnim: Implement route path element XML tag
John Abraham <john.abraham.in@gmail.com>
parents:
9246
diff
changeset
|
1791 |
Ipv4RoutePathElement elem = { trackElement.fromNodeId, oss.str () }; |
740c45821021
NetAnim: Implement route path element XML tag
John Abraham <john.abraham.in@gmail.com>
parents:
9246
diff
changeset
|
1792 |
rpElements.push_back (elem); |
740c45821021
NetAnim: Implement route path element XML tag
John Abraham <john.abraham.in@gmail.com>
parents:
9246
diff
changeset
|
1793 |
} |
740c45821021
NetAnim: Implement route path element XML tag
John Abraham <john.abraham.in@gmail.com>
parents:
9246
diff
changeset
|
1794 |
RecursiveIpv4RoutePathSearch (oss.str (), trackElement.destination, rpElements); |
740c45821021
NetAnim: Implement route path element XML tag
John Abraham <john.abraham.in@gmail.com>
parents:
9246
diff
changeset
|
1795 |
WriteRoutePath (trackElement.fromNodeId, trackElement.destination, rpElements); |
9246
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1796 |
} |
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1797 |
|
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1798 |
} |
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1799 |
|
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1800 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1801 |
AnimationInterface::TrackQueueCounters () |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1802 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1803 |
if (Simulator::Now () > m_queueCountersStopTime) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1804 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1805 |
NS_LOG_INFO ("TrackQueueCounters Completed"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1806 |
return; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1807 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1808 |
for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); ++i) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1809 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1810 |
uint32_t nodeId = Ptr <Node> (*i)->GetId (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1811 |
UpdateNodeCounter (m_queueEnqueueCounterId, nodeId, m_nodeQueueEnqueue[nodeId]); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1812 |
UpdateNodeCounter (m_queueDequeueCounterId, nodeId, m_nodeQueueDequeue[nodeId]); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1813 |
UpdateNodeCounter (m_queueDropCounterId, nodeId, m_nodeQueueDrop[nodeId]); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1814 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1815 |
Simulator::Schedule (m_queueCountersPollInterval, &AnimationInterface::TrackQueueCounters, this); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1816 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1817 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1818 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1819 |
AnimationInterface::TrackWifiMacCounters () |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1820 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1821 |
if (Simulator::Now () > m_wifiMacCountersStopTime) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1822 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1823 |
NS_LOG_INFO ("TrackWifiMacCounters Completed"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1824 |
return; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1825 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1826 |
for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); ++i) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1827 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1828 |
uint32_t nodeId = Ptr <Node> (*i)->GetId (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1829 |
UpdateNodeCounter (m_wifiMacTxCounterId, nodeId, m_nodeWifiMacTx[nodeId]); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1830 |
UpdateNodeCounter (m_wifiMacTxDropCounterId, nodeId, m_nodeWifiMacTxDrop[nodeId]); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1831 |
UpdateNodeCounter (m_wifiMacRxCounterId, nodeId, m_nodeWifiMacRx[nodeId]); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1832 |
UpdateNodeCounter (m_wifiMacRxDropCounterId, nodeId, m_nodeWifiMacRxDrop[nodeId]); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1833 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1834 |
Simulator::Schedule (m_wifiMacCountersPollInterval, &AnimationInterface::TrackWifiMacCounters, this); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1835 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1836 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1837 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1838 |
AnimationInterface::TrackWifiPhyCounters () |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1839 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1840 |
if (Simulator::Now () > m_wifiPhyCountersStopTime) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1841 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1842 |
NS_LOG_INFO ("TrackWifiPhyCounters Completed"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1843 |
return; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1844 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1845 |
for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); ++i) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1846 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1847 |
uint32_t nodeId = Ptr <Node> (*i)->GetId (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1848 |
UpdateNodeCounter (m_wifiPhyTxDropCounterId, nodeId, m_nodeWifiPhyTxDrop[nodeId]); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1849 |
UpdateNodeCounter (m_wifiPhyRxDropCounterId, nodeId, m_nodeWifiPhyRxDrop[nodeId]); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1850 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1851 |
Simulator::Schedule (m_wifiPhyCountersPollInterval, &AnimationInterface::TrackWifiPhyCounters, this); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1852 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1853 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1854 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1855 |
AnimationInterface::TrackIpv4L3ProtocolCounters () |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1856 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1857 |
if (Simulator::Now () > m_ipv4L3ProtocolCountersStopTime) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1858 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1859 |
NS_LOG_INFO ("TrackIpv4L3ProtocolCounters Completed"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1860 |
return; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1861 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1862 |
for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); ++i) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1863 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1864 |
uint32_t nodeId = Ptr <Node> (*i)->GetId (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1865 |
UpdateNodeCounter (m_ipv4L3ProtocolTxCounterId, nodeId, m_nodeIpv4Tx[nodeId]); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1866 |
UpdateNodeCounter (m_ipv4L3ProtocolRxCounterId, nodeId, m_nodeIpv4Rx[nodeId]); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1867 |
UpdateNodeCounter (m_ipv4L3ProtocolDropCounterId, nodeId, m_nodeIpv4Drop[nodeId]); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1868 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1869 |
Simulator::Schedule (m_ipv4L3ProtocolCountersPollInterval, &AnimationInterface::TrackIpv4L3ProtocolCounters, this); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1870 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1871 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1872 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1873 |
AnimationInterface::TrackIpv4Route () |
9161
9c62cfdc7946
NetAnim: Add support for tracking routing table
John Abraham <john.abraham.in@gmail.com>
parents:
9158
diff
changeset
|
1874 |
{ |
9c62cfdc7946
NetAnim: Add support for tracking routing table
John Abraham <john.abraham.in@gmail.com>
parents:
9158
diff
changeset
|
1875 |
if (Simulator::Now () > m_routingStopTime) |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1876 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1877 |
NS_LOG_INFO ("TrackIpv4Route completed"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1878 |
return; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1879 |
} |
9161
9c62cfdc7946
NetAnim: Add support for tracking routing table
John Abraham <john.abraham.in@gmail.com>
parents:
9158
diff
changeset
|
1880 |
if (m_routingNc.GetN ()) |
9c62cfdc7946
NetAnim: Add support for tracking routing table
John Abraham <john.abraham.in@gmail.com>
parents:
9158
diff
changeset
|
1881 |
{ |
9c62cfdc7946
NetAnim: Add support for tracking routing table
John Abraham <john.abraham.in@gmail.com>
parents:
9158
diff
changeset
|
1882 |
for (NodeContainer::Iterator i = m_routingNc.Begin (); i != m_routingNc.End (); ++i) |
9c62cfdc7946
NetAnim: Add support for tracking routing table
John Abraham <john.abraham.in@gmail.com>
parents:
9158
diff
changeset
|
1883 |
{ |
9c62cfdc7946
NetAnim: Add support for tracking routing table
John Abraham <john.abraham.in@gmail.com>
parents:
9158
diff
changeset
|
1884 |
Ptr <Node> n = *i; |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1885 |
WriteXmlRouting (n->GetId (), GetIpv4RoutingTable (n)); |
9161
9c62cfdc7946
NetAnim: Add support for tracking routing table
John Abraham <john.abraham.in@gmail.com>
parents:
9158
diff
changeset
|
1886 |
} |
9c62cfdc7946
NetAnim: Add support for tracking routing table
John Abraham <john.abraham.in@gmail.com>
parents:
9158
diff
changeset
|
1887 |
} |
9c62cfdc7946
NetAnim: Add support for tracking routing table
John Abraham <john.abraham.in@gmail.com>
parents:
9158
diff
changeset
|
1888 |
else |
9c62cfdc7946
NetAnim: Add support for tracking routing table
John Abraham <john.abraham.in@gmail.com>
parents:
9158
diff
changeset
|
1889 |
{ |
9c62cfdc7946
NetAnim: Add support for tracking routing table
John Abraham <john.abraham.in@gmail.com>
parents:
9158
diff
changeset
|
1890 |
for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); ++i) |
9c62cfdc7946
NetAnim: Add support for tracking routing table
John Abraham <john.abraham.in@gmail.com>
parents:
9158
diff
changeset
|
1891 |
{ |
9c62cfdc7946
NetAnim: Add support for tracking routing table
John Abraham <john.abraham.in@gmail.com>
parents:
9158
diff
changeset
|
1892 |
Ptr <Node> n = *i; |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1893 |
WriteXmlRouting (n->GetId (), GetIpv4RoutingTable (n)); |
9161
9c62cfdc7946
NetAnim: Add support for tracking routing table
John Abraham <john.abraham.in@gmail.com>
parents:
9158
diff
changeset
|
1894 |
} |
9c62cfdc7946
NetAnim: Add support for tracking routing table
John Abraham <john.abraham.in@gmail.com>
parents:
9158
diff
changeset
|
1895 |
} |
9247
740c45821021
NetAnim: Implement route path element XML tag
John Abraham <john.abraham.in@gmail.com>
parents:
9246
diff
changeset
|
1896 |
TrackIpv4RoutePaths (); |
9161
9c62cfdc7946
NetAnim: Add support for tracking routing table
John Abraham <john.abraham.in@gmail.com>
parents:
9158
diff
changeset
|
1897 |
Simulator::Schedule (m_routingPollInterval, &AnimationInterface::TrackIpv4Route, this); |
9c62cfdc7946
NetAnim: Add support for tracking routing table
John Abraham <john.abraham.in@gmail.com>
parents:
9158
diff
changeset
|
1898 |
} |
9c62cfdc7946
NetAnim: Add support for tracking routing table
John Abraham <john.abraham.in@gmail.com>
parents:
9158
diff
changeset
|
1899 |
|
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1900 |
std::string |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1901 |
AnimationInterface::GetIpv4RoutingTable (Ptr <Node> n) |
8861
b1f287b36ff7
NetAnim: Add tentative Uan Phy Gen callback
John Abraham <john.abraham@gatech.edu>
parents:
8807
diff
changeset
|
1902 |
{ |
b1f287b36ff7
NetAnim: Add tentative Uan Phy Gen callback
John Abraham <john.abraham@gatech.edu>
parents:
8807
diff
changeset
|
1903 |
|
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1904 |
NS_ASSERT (n); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1905 |
Ptr <ns3::Ipv4> ipv4 = n->GetObject <ns3::Ipv4> (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1906 |
if (!ipv4) |
7360
5949904cf955
Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents:
7256
diff
changeset
|
1907 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1908 |
NS_LOG_WARN ("Node " << n->GetId () << " Does not have an Ipv4 object"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1909 |
return ""; |
7360
5949904cf955
Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents:
7256
diff
changeset
|
1910 |
} |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1911 |
std::stringstream stream; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1912 |
Ptr<OutputStreamWrapper> routingstream = Create<OutputStreamWrapper> (&stream); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1913 |
ipv4->GetRoutingProtocol ()->PrintRoutingTable (routingstream); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1914 |
return stream.str (); |
7606
958775025f35
NetAnim: One time initialization, fixes for long duration runs
John Abraham <john.abraham@gatech.edu>
parents:
7595
diff
changeset
|
1915 |
|
958775025f35
NetAnim: One time initialization, fixes for long duration runs
John Abraham <john.abraham@gatech.edu>
parents:
7595
diff
changeset
|
1916 |
} |
958775025f35
NetAnim: One time initialization, fixes for long duration runs
John Abraham <john.abraham@gatech.edu>
parents:
7595
diff
changeset
|
1917 |
|
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1918 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1919 |
AnimationInterface::RecursiveIpv4RoutePathSearch (std::string from, std::string to, Ipv4RoutePathElements & rpElements) |
7606
958775025f35
NetAnim: One time initialization, fixes for long duration runs
John Abraham <john.abraham@gatech.edu>
parents:
7595
diff
changeset
|
1920 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1921 |
NS_LOG_INFO ("RecursiveIpv4RoutePathSearch from:" << from.c_str () << " to:" << to.c_str ()); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1922 |
if ((from == "0.0.0.0") || (from == "127.0.0.1")) |
7606
958775025f35
NetAnim: One time initialization, fixes for long duration runs
John Abraham <john.abraham@gatech.edu>
parents:
7595
diff
changeset
|
1923 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1924 |
NS_LOG_INFO ("Got " << from.c_str () << " End recursion"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1925 |
return; |
7606
958775025f35
NetAnim: One time initialization, fixes for long duration runs
John Abraham <john.abraham@gatech.edu>
parents:
7595
diff
changeset
|
1926 |
} |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1927 |
Ptr <Node> fromNode = NodeList::GetNode (m_ipv4ToNodeIdMap[from]); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1928 |
Ptr <Node> toNode = NodeList::GetNode (m_ipv4ToNodeIdMap[to]); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1929 |
if (fromNode->GetId () == toNode->GetId ()) |
7606
958775025f35
NetAnim: One time initialization, fixes for long duration runs
John Abraham <john.abraham@gatech.edu>
parents:
7595
diff
changeset
|
1930 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1931 |
Ipv4RoutePathElement elem = { fromNode->GetId (), "L" }; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1932 |
rpElements.push_back (elem); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1933 |
return; |
7606
958775025f35
NetAnim: One time initialization, fixes for long duration runs
John Abraham <john.abraham@gatech.edu>
parents:
7595
diff
changeset
|
1934 |
} |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1935 |
if (!fromNode) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1936 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1937 |
NS_FATAL_ERROR ("Node: " << m_ipv4ToNodeIdMap[from] << " Not found"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1938 |
return; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1939 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1940 |
if (!toNode) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1941 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1942 |
NS_FATAL_ERROR ("Node: " << m_ipv4ToNodeIdMap[to] << " Not found"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1943 |
return; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1944 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1945 |
Ptr <ns3::Ipv4> ipv4 = fromNode->GetObject <ns3::Ipv4> (); |
8955
eab99e446e8c
NetAnim: Support End-point Ipv4 address on link display
John Abraham <john.abraham.in@gmail.com>
parents:
8948
diff
changeset
|
1946 |
if (!ipv4) |
9246
77b5a7129d59
NetAnim: Missing Ipv4 Addresses when Ptr<Channel> is unavailable
John Abraham <john.abraham.in@gmail.com>
parents:
9245
diff
changeset
|
1947 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1948 |
NS_LOG_WARN ("ipv4 object not found"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1949 |
return; |
9115
c9b19f516c5f
NetAnim: Skip ipaddress check if index cannot be found
John Abraham <john.abraham.in@gmail.com>
parents:
9109
diff
changeset
|
1950 |
} |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1951 |
Ptr <Ipv4RoutingProtocol> rp = ipv4->GetRoutingProtocol (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1952 |
if (!rp) |
5776 | 1953 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1954 |
NS_LOG_WARN ("Routing protocol object not found"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1955 |
return; |
5776 | 1956 |
} |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1957 |
Ptr<Packet> pkt = Create<Packet> (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1958 |
Ipv4Header header; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1959 |
header.SetDestination (Ipv4Address (to.c_str ())); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1960 |
Socket::SocketErrno sockerr; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1961 |
Ptr <Ipv4Route> rt = rp->RouteOutput (pkt, header, 0, sockerr); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1962 |
if (!rt) |
10560
666b4bbc0348
NetAnim: Enable transition to 3.105
John Abraham <john.abraham.in@gmail.com>
parents:
10559
diff
changeset
|
1963 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1964 |
return; |
7360
5949904cf955
Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents:
7256
diff
changeset
|
1965 |
} |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1966 |
NS_LOG_DEBUG ("Node: " << fromNode->GetId () << " G:" << rt->GetGateway ()); |
8807
fcb718d36baa
NetAnim: Update LTE callbacks after recent lena commit
John Abraham <john.abraham@gatech.edu>
parents:
8804
diff
changeset
|
1967 |
std::ostringstream oss; |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1968 |
oss << rt->GetGateway (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1969 |
if (oss.str () == "0.0.0.0" && (sockerr != Socket::ERROR_NOROUTETOHOST)) |
8807
fcb718d36baa
NetAnim: Update LTE callbacks after recent lena commit
John Abraham <john.abraham@gatech.edu>
parents:
8804
diff
changeset
|
1970 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1971 |
NS_LOG_INFO ("Null gw"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1972 |
Ipv4RoutePathElement elem = { fromNode->GetId (), "C" }; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1973 |
rpElements.push_back (elem); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1974 |
if ( m_ipv4ToNodeIdMap.find (to) != m_ipv4ToNodeIdMap.end ()) |
8807
fcb718d36baa
NetAnim: Update LTE callbacks after recent lena commit
John Abraham <john.abraham@gatech.edu>
parents:
8804
diff
changeset
|
1975 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1976 |
Ipv4RoutePathElement elem2 = { m_ipv4ToNodeIdMap[to], "L" }; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1977 |
rpElements.push_back (elem2); |
8807
fcb718d36baa
NetAnim: Update LTE callbacks after recent lena commit
John Abraham <john.abraham@gatech.edu>
parents:
8804
diff
changeset
|
1978 |
} |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1979 |
return; |
8807
fcb718d36baa
NetAnim: Update LTE callbacks after recent lena commit
John Abraham <john.abraham@gatech.edu>
parents:
8804
diff
changeset
|
1980 |
} |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1981 |
NS_LOG_INFO ("Node:" << fromNode->GetId () << "-->" << rt->GetGateway ()); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1982 |
Ipv4RoutePathElement elem = { fromNode->GetId (), oss.str () }; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1983 |
rpElements.push_back (elem); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1984 |
RecursiveIpv4RoutePathSearch (oss.str (), to, rpElements); |
7360
5949904cf955
Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents:
7256
diff
changeset
|
1985 |
|
7606
958775025f35
NetAnim: One time initialization, fixes for long duration runs
John Abraham <john.abraham@gatech.edu>
parents:
7595
diff
changeset
|
1986 |
} |
7360
5949904cf955
Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents:
7256
diff
changeset
|
1987 |
|
5776 | 1988 |
|
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1989 |
// XML |
5776 | 1990 |
|
11618
1de158f7e17a
Bug 2170 - AnimationInterface outputs improperly formed XML
miilic
parents:
11430
diff
changeset
|
1991 |
AnimationInterface::AnimXmlElement::AnimXmlElement (std::string tagName, bool emptyElement): |
1de158f7e17a
Bug 2170 - AnimationInterface outputs improperly formed XML
miilic
parents:
11430
diff
changeset
|
1992 |
m_tagName (tagName), |
1de158f7e17a
Bug 2170 - AnimationInterface outputs improperly formed XML
miilic
parents:
11430
diff
changeset
|
1993 |
m_emptyElement (emptyElement) |
7362
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
1994 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1995 |
m_elementString = "<" + tagName + " "; |
7360
5949904cf955
Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents:
7256
diff
changeset
|
1996 |
} |
9109
a09a1899429d
NetAnim: Add support for ipv4 address printing for non-p2p
John Abraham <john.abraham.in@gmail.com>
parents:
9108
diff
changeset
|
1997 |
|
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1998 |
template <typename T> |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
1999 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2000 |
AnimationInterface::AnimXmlElement::AddAttribute (std::string attribute, T value) |
9109
a09a1899429d
NetAnim: Add support for ipv4 address printing for non-p2p
John Abraham <john.abraham.in@gmail.com>
parents:
9108
diff
changeset
|
2001 |
{ |
a09a1899429d
NetAnim: Add support for ipv4 address printing for non-p2p
John Abraham <john.abraham.in@gmail.com>
parents:
9108
diff
changeset
|
2002 |
std::ostringstream oss; |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2003 |
oss << std::setprecision (10); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2004 |
oss << value; |
10827 | 2005 |
m_elementString += attribute.c_str (); |
2006 |
m_elementString += "=\"" + oss.str () + "\" "; |
|
7362
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2007 |
} |
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2008 |
|
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2009 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2010 |
AnimationInterface::AnimXmlElement::Close () |
8861
b1f287b36ff7
NetAnim: Add tentative Uan Phy Gen callback
John Abraham <john.abraham@gatech.edu>
parents:
8807
diff
changeset
|
2011 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2012 |
m_elementString += ">\n"; |
8861
b1f287b36ff7
NetAnim: Add tentative Uan Phy Gen callback
John Abraham <john.abraham@gatech.edu>
parents:
8807
diff
changeset
|
2013 |
} |
b1f287b36ff7
NetAnim: Add tentative Uan Phy Gen callback
John Abraham <john.abraham@gatech.edu>
parents:
8807
diff
changeset
|
2014 |
|
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2015 |
void |
11618
1de158f7e17a
Bug 2170 - AnimationInterface outputs improperly formed XML
miilic
parents:
11430
diff
changeset
|
2016 |
AnimationInterface::AnimXmlElement::CloseElement () |
1de158f7e17a
Bug 2170 - AnimationInterface outputs improperly formed XML
miilic
parents:
11430
diff
changeset
|
2017 |
{ |
1de158f7e17a
Bug 2170 - AnimationInterface outputs improperly formed XML
miilic
parents:
11430
diff
changeset
|
2018 |
if (m_emptyElement) |
1de158f7e17a
Bug 2170 - AnimationInterface outputs improperly formed XML
miilic
parents:
11430
diff
changeset
|
2019 |
{ |
1de158f7e17a
Bug 2170 - AnimationInterface outputs improperly formed XML
miilic
parents:
11430
diff
changeset
|
2020 |
m_elementString += "/>\n"; |
1de158f7e17a
Bug 2170 - AnimationInterface outputs improperly formed XML
miilic
parents:
11430
diff
changeset
|
2021 |
} |
1de158f7e17a
Bug 2170 - AnimationInterface outputs improperly formed XML
miilic
parents:
11430
diff
changeset
|
2022 |
else |
1de158f7e17a
Bug 2170 - AnimationInterface outputs improperly formed XML
miilic
parents:
11430
diff
changeset
|
2023 |
{ |
1de158f7e17a
Bug 2170 - AnimationInterface outputs improperly formed XML
miilic
parents:
11430
diff
changeset
|
2024 |
m_elementString += "</" + m_tagName + ">\n"; |
1de158f7e17a
Bug 2170 - AnimationInterface outputs improperly formed XML
miilic
parents:
11430
diff
changeset
|
2025 |
} |
1de158f7e17a
Bug 2170 - AnimationInterface outputs improperly formed XML
miilic
parents:
11430
diff
changeset
|
2026 |
} |
1de158f7e17a
Bug 2170 - AnimationInterface outputs improperly formed XML
miilic
parents:
11430
diff
changeset
|
2027 |
|
1de158f7e17a
Bug 2170 - AnimationInterface outputs improperly formed XML
miilic
parents:
11430
diff
changeset
|
2028 |
void |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2029 |
AnimationInterface::AnimXmlElement::CloseTag () |
7360
5949904cf955
Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents:
7256
diff
changeset
|
2030 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2031 |
m_elementString += ">"; |
7360
5949904cf955
Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents:
7256
diff
changeset
|
2032 |
} |
5949904cf955
Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents:
7256
diff
changeset
|
2033 |
|
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2034 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2035 |
AnimationInterface::AnimXmlElement::AddLineBreak () |
7360
5949904cf955
Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents:
7256
diff
changeset
|
2036 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2037 |
m_elementString += "\n"; |
7484
cd2d8cd79237
NetAnim: Connect Csma traces
John Abraham <john.abraham@gatech.edu>
parents:
7476
diff
changeset
|
2038 |
} |
cd2d8cd79237
NetAnim: Connect Csma traces
John Abraham <john.abraham@gatech.edu>
parents:
7476
diff
changeset
|
2039 |
|
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2040 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2041 |
AnimationInterface::AnimXmlElement::Add (AnimXmlElement e) |
7484
cd2d8cd79237
NetAnim: Connect Csma traces
John Abraham <john.abraham@gatech.edu>
parents:
7476
diff
changeset
|
2042 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2043 |
m_elementString += e.GetElementString (); |
7360
5949904cf955
Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents:
7256
diff
changeset
|
2044 |
} |
5949904cf955
Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents:
7256
diff
changeset
|
2045 |
|
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2046 |
std::string |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2047 |
AnimationInterface::AnimXmlElement::GetElementString () |
7360
5949904cf955
Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents:
7256
diff
changeset
|
2048 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2049 |
return m_elementString; |
7752
afbec264cbd2
NetAnim: Tentative support for LTE
John Abraham <john.abraham@gatech.edu>
parents:
7618
diff
changeset
|
2050 |
} |
afbec264cbd2
NetAnim: Tentative support for LTE
John Abraham <john.abraham@gatech.edu>
parents:
7618
diff
changeset
|
2051 |
|
afbec264cbd2
NetAnim: Tentative support for LTE
John Abraham <john.abraham@gatech.edu>
parents:
7618
diff
changeset
|
2052 |
|
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2053 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2054 |
AnimationInterface::WriteXmlAnim (bool routing) |
7752
afbec264cbd2
NetAnim: Tentative support for LTE
John Abraham <john.abraham@gatech.edu>
parents:
7618
diff
changeset
|
2055 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2056 |
AnimXmlElement element ("anim"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2057 |
element.AddAttribute ("ver", GetNetAnimVersion ()); |
11224
7d0449e73dc8
[Bug 2065] New: Segfault on probable user error
John Abraham
parents:
11218
diff
changeset
|
2058 |
FILE * f = m_f; |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2059 |
if (!routing) |
9204
dfcc276e4459
NetAnim: Lte trace sources changed since ns-3.15
John Abraham <john.abraham.in@gmail.com>
parents:
9171
diff
changeset
|
2060 |
{ |
11224
7d0449e73dc8
[Bug 2065] New: Segfault on probable user error
John Abraham
parents:
11218
diff
changeset
|
2061 |
element.AddAttribute ("filetype", "animation"); |
9204
dfcc276e4459
NetAnim: Lte trace sources changed since ns-3.15
John Abraham <john.abraham.in@gmail.com>
parents:
9171
diff
changeset
|
2062 |
} |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2063 |
else |
7529
6b1df8b6df34
NetAnim: Remove obsolete socket functionalities
John Abraham <john.abraham@gatech.edu>
parents:
7484
diff
changeset
|
2064 |
{ |
11224
7d0449e73dc8
[Bug 2065] New: Segfault on probable user error
John Abraham
parents:
11218
diff
changeset
|
2065 |
element.AddAttribute ("filetype", "routing"); |
7d0449e73dc8
[Bug 2065] New: Segfault on probable user error
John Abraham
parents:
11218
diff
changeset
|
2066 |
f = m_routingF; |
10117
9d731ea9c62e
Bug 1747 - Openflow traces not triggering on some occasions
John Abraham <john.abraham.in@gmail.com>
parents:
9977
diff
changeset
|
2067 |
} |
11224
7d0449e73dc8
[Bug 2065] New: Segfault on probable user error
John Abraham
parents:
11218
diff
changeset
|
2068 |
element.Close (); |
7d0449e73dc8
[Bug 2065] New: Segfault on probable user error
John Abraham
parents:
11218
diff
changeset
|
2069 |
WriteN (element.GetElementString (), f); |
7484
cd2d8cd79237
NetAnim: Connect Csma traces
John Abraham <john.abraham@gatech.edu>
parents:
7476
diff
changeset
|
2070 |
} |
cd2d8cd79237
NetAnim: Connect Csma traces
John Abraham <john.abraham@gatech.edu>
parents:
7476
diff
changeset
|
2071 |
|
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2072 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2073 |
AnimationInterface::WriteXmlClose (std::string name, bool routing) |
7484
cd2d8cd79237
NetAnim: Connect Csma traces
John Abraham <john.abraham@gatech.edu>
parents:
7476
diff
changeset
|
2074 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2075 |
std::string closeString = "</" + name + ">\n"; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2076 |
if (!routing) |
7484
cd2d8cd79237
NetAnim: Connect Csma traces
John Abraham <john.abraham@gatech.edu>
parents:
7476
diff
changeset
|
2077 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2078 |
WriteN (closeString, m_f); |
10560
666b4bbc0348
NetAnim: Enable transition to 3.105
John Abraham <john.abraham.in@gmail.com>
parents:
10559
diff
changeset
|
2079 |
} |
666b4bbc0348
NetAnim: Enable transition to 3.105
John Abraham <john.abraham.in@gmail.com>
parents:
10559
diff
changeset
|
2080 |
else |
666b4bbc0348
NetAnim: Enable transition to 3.105
John Abraham <john.abraham.in@gmail.com>
parents:
10559
diff
changeset
|
2081 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2082 |
WriteN (closeString, m_routingF); |
7360
5949904cf955
Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents:
7256
diff
changeset
|
2083 |
} |
5949904cf955
Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents:
7256
diff
changeset
|
2084 |
} |
5949904cf955
Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents:
7256
diff
changeset
|
2085 |
|
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2086 |
void |
10843
c0075b54818c
NetAnim: Support for system id associated with nodes
Dmitrii Shakshin <d.shakshin@gmail.com>
parents:
10827
diff
changeset
|
2087 |
AnimationInterface::WriteXmlNode (uint32_t id, uint32_t sysId, double locX, double locY) |
7360
5949904cf955
Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents:
7256
diff
changeset
|
2088 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2089 |
AnimXmlElement element ("node"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2090 |
element.AddAttribute ("id", id); |
10843
c0075b54818c
NetAnim: Support for system id associated with nodes
Dmitrii Shakshin <d.shakshin@gmail.com>
parents:
10827
diff
changeset
|
2091 |
element.AddAttribute ("sysId", sysId); |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2092 |
element.AddAttribute ("locX", locX); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2093 |
element.AddAttribute ("locY", locY); |
11618
1de158f7e17a
Bug 2170 - AnimationInterface outputs improperly formed XML
miilic
parents:
11430
diff
changeset
|
2094 |
element.CloseElement (); |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2095 |
WriteN (element.GetElementString (), m_f); |
10485
83fc28889371
Added remaining energy tracing (Task #4593)
Evgeny Kalishenko <ydginster@gmail.com>
parents:
10197
diff
changeset
|
2096 |
} |
83fc28889371
Added remaining energy tracing (Task #4593)
Evgeny Kalishenko <ydginster@gmail.com>
parents:
10197
diff
changeset
|
2097 |
|
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2098 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2099 |
AnimationInterface::WriteXmlUpdateLink (uint32_t fromId, uint32_t toId, std::string linkDescription) |
8932
9ada3b7d7c94
NetAnim: Add link update XML tag
John Abraham <john.abraham.in@gmail.com>
parents:
8930
diff
changeset
|
2100 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2101 |
AnimXmlElement element ("linkupdate"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2102 |
element.AddAttribute ("t", Simulator::Now ().GetSeconds ()); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2103 |
element.AddAttribute ("fromId", fromId); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2104 |
element.AddAttribute ("toId", toId); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2105 |
element.AddAttribute ("ld", linkDescription); |
11618
1de158f7e17a
Bug 2170 - AnimationInterface outputs improperly formed XML
miilic
parents:
11430
diff
changeset
|
2106 |
element.CloseElement (); |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2107 |
WriteN (element.GetElementString (), m_f); |
7823
2a669a0c452e
NetAnim: Add description to NodeContainers
John Abraham <john.abraham@gatech.edu>
parents:
7808
diff
changeset
|
2108 |
} |
2a669a0c452e
NetAnim: Add description to NodeContainers
John Abraham <john.abraham@gatech.edu>
parents:
7808
diff
changeset
|
2109 |
|
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2110 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2111 |
AnimationInterface::WriteXmlLink (uint32_t fromId, uint32_t toLp, uint32_t toId) |
8934
bc42868d23a7
NetAnim: Add nodeupdate XML tag
John Abraham <john.abraham.in@gmail.com>
parents:
8933
diff
changeset
|
2112 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2113 |
AnimXmlElement element ("link"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2114 |
element.AddAttribute ("fromId", fromId); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2115 |
element.AddAttribute ("toId", toId); |
8928
95b9af52352f
NetAnim: Support for link description
John Abraham <john.abraham.in@gmail.com>
parents:
8898
diff
changeset
|
2116 |
|
8930
d53b7df1162c
NetAnim: Change SetLinkDescription defaults
John Abraham <john.abraham.in@gmail.com>
parents:
8928
diff
changeset
|
2117 |
LinkProperties lprop ; |
d53b7df1162c
NetAnim: Change SetLinkDescription defaults
John Abraham <john.abraham.in@gmail.com>
parents:
8928
diff
changeset
|
2118 |
lprop.fromNodeDescription = ""; |
d53b7df1162c
NetAnim: Change SetLinkDescription defaults
John Abraham <john.abraham.in@gmail.com>
parents:
8928
diff
changeset
|
2119 |
lprop.toNodeDescription = ""; |
d53b7df1162c
NetAnim: Change SetLinkDescription defaults
John Abraham <john.abraham.in@gmail.com>
parents:
8928
diff
changeset
|
2120 |
lprop.linkDescription = ""; |
8928
95b9af52352f
NetAnim: Support for link description
John Abraham <john.abraham.in@gmail.com>
parents:
8898
diff
changeset
|
2121 |
|
8930
d53b7df1162c
NetAnim: Change SetLinkDescription defaults
John Abraham <john.abraham.in@gmail.com>
parents:
8928
diff
changeset
|
2122 |
P2pLinkNodeIdPair p1 = { fromId, toId }; |
d53b7df1162c
NetAnim: Change SetLinkDescription defaults
John Abraham <john.abraham.in@gmail.com>
parents:
8928
diff
changeset
|
2123 |
P2pLinkNodeIdPair p2 = { toId, fromId }; |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2124 |
if (m_linkProperties.find (p1) != m_linkProperties.end ()) |
8928
95b9af52352f
NetAnim: Support for link description
John Abraham <john.abraham.in@gmail.com>
parents:
8898
diff
changeset
|
2125 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2126 |
lprop = m_linkProperties[p1]; |
8928
95b9af52352f
NetAnim: Support for link description
John Abraham <john.abraham.in@gmail.com>
parents:
8898
diff
changeset
|
2127 |
} |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2128 |
else if (m_linkProperties.find (p2) != m_linkProperties.end ()) |
8930
d53b7df1162c
NetAnim: Change SetLinkDescription defaults
John Abraham <john.abraham.in@gmail.com>
parents:
8928
diff
changeset
|
2129 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2130 |
lprop = m_linkProperties[p2]; |
8930
d53b7df1162c
NetAnim: Change SetLinkDescription defaults
John Abraham <john.abraham.in@gmail.com>
parents:
8928
diff
changeset
|
2131 |
} |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2132 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2133 |
element.AddAttribute ("fd", lprop.fromNodeDescription); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2134 |
element.AddAttribute ("td", lprop.toNodeDescription); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2135 |
element.AddAttribute ("ld", lprop.linkDescription); |
11618
1de158f7e17a
Bug 2170 - AnimationInterface outputs improperly formed XML
miilic
parents:
11430
diff
changeset
|
2136 |
element.CloseElement (); |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2137 |
WriteN (element.GetElementString (), m_f); |
7360
5949904cf955
Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents:
7256
diff
changeset
|
2138 |
} |
5949904cf955
Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents:
7256
diff
changeset
|
2139 |
|
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2140 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2141 |
AnimationInterface::WriteXmlRouting (uint32_t nodeId, std::string routingInfo) |
7360
5949904cf955
Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents:
7256
diff
changeset
|
2142 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2143 |
AnimXmlElement element ("rt"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2144 |
element.AddAttribute ("t", Simulator::Now ().GetSeconds ()); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2145 |
element.AddAttribute ("id", nodeId); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2146 |
element.AddAttribute ("info", routingInfo.c_str ()); |
11618
1de158f7e17a
Bug 2170 - AnimationInterface outputs improperly formed XML
miilic
parents:
11430
diff
changeset
|
2147 |
element.CloseElement (); |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2148 |
WriteN (element.GetElementString (), m_routingF); |
7360
5949904cf955
Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents:
7256
diff
changeset
|
2149 |
} |
5949904cf955
Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents:
7256
diff
changeset
|
2150 |
|
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2151 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2152 |
AnimationInterface::WriteXmlRp (uint32_t nodeId, std::string destination, Ipv4RoutePathElements rpElements) |
9161
9c62cfdc7946
NetAnim: Add support for tracking routing table
John Abraham <john.abraham.in@gmail.com>
parents:
9158
diff
changeset
|
2153 |
{ |
11618
1de158f7e17a
Bug 2170 - AnimationInterface outputs improperly formed XML
miilic
parents:
11430
diff
changeset
|
2154 |
std::string tagName = "rp"; |
1de158f7e17a
Bug 2170 - AnimationInterface outputs improperly formed XML
miilic
parents:
11430
diff
changeset
|
2155 |
AnimXmlElement element (tagName, false); |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2156 |
element.AddAttribute ("t", Simulator::Now ().GetSeconds ()); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2157 |
element.AddAttribute ("id", nodeId); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2158 |
element.AddAttribute ("d", destination.c_str ()); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2159 |
element.AddAttribute ("c", rpElements.size ()); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2160 |
element.CloseTag (); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2161 |
element.AddLineBreak (); |
9247
740c45821021
NetAnim: Implement route path element XML tag
John Abraham <john.abraham.in@gmail.com>
parents:
9246
diff
changeset
|
2162 |
for (Ipv4RoutePathElements::const_iterator i = rpElements.begin (); |
740c45821021
NetAnim: Implement route path element XML tag
John Abraham <john.abraham.in@gmail.com>
parents:
9246
diff
changeset
|
2163 |
i != rpElements.end (); |
740c45821021
NetAnim: Implement route path element XML tag
John Abraham <john.abraham.in@gmail.com>
parents:
9246
diff
changeset
|
2164 |
++i) |
740c45821021
NetAnim: Implement route path element XML tag
John Abraham <john.abraham.in@gmail.com>
parents:
9246
diff
changeset
|
2165 |
{ |
740c45821021
NetAnim: Implement route path element XML tag
John Abraham <john.abraham.in@gmail.com>
parents:
9246
diff
changeset
|
2166 |
Ipv4RoutePathElement rpElement = *i; |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2167 |
AnimXmlElement rpeElement ("rpe"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2168 |
rpeElement.AddAttribute ("n", rpElement.nodeId); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2169 |
rpeElement.AddAttribute ("nH", rpElement.nextHop.c_str ()); |
11618
1de158f7e17a
Bug 2170 - AnimationInterface outputs improperly formed XML
miilic
parents:
11430
diff
changeset
|
2170 |
rpeElement.CloseElement (); |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2171 |
element.Add (rpeElement); |
9247
740c45821021
NetAnim: Implement route path element XML tag
John Abraham <john.abraham.in@gmail.com>
parents:
9246
diff
changeset
|
2172 |
} |
11618
1de158f7e17a
Bug 2170 - AnimationInterface outputs improperly formed XML
miilic
parents:
11430
diff
changeset
|
2173 |
element.CloseElement (); |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2174 |
WriteN (element.GetElementString (), m_routingF); |
9064
21326214dcd5
NetAnim: more compact packet format
John Abraham <john.abraham.in@gmail.com>
parents:
9063
diff
changeset
|
2175 |
} |
21326214dcd5
NetAnim: more compact packet format
John Abraham <john.abraham.in@gmail.com>
parents:
9063
diff
changeset
|
2176 |
|
21326214dcd5
NetAnim: more compact packet format
John Abraham <john.abraham.in@gmail.com>
parents:
9063
diff
changeset
|
2177 |
|
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2178 |
void |
11336
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
2179 |
AnimationInterface::WriteXmlPRef (uint64_t animUid, uint32_t fId, double fbTx, std::string metaInfo) |
7360
5949904cf955
Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents:
7256
diff
changeset
|
2180 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2181 |
AnimXmlElement element ("pr"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2182 |
element.AddAttribute ("uId", animUid); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2183 |
element.AddAttribute ("fId", fId); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2184 |
element.AddAttribute ("fbTx", fbTx); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2185 |
if (!metaInfo.empty ()) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2186 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2187 |
element.AddAttribute ("meta-info", metaInfo.c_str ()); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2188 |
} |
11618
1de158f7e17a
Bug 2170 - AnimationInterface outputs improperly formed XML
miilic
parents:
11430
diff
changeset
|
2189 |
element.CloseElement (); |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2190 |
WriteN (element.GetElementString (), m_f); |
7360
5949904cf955
Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents:
7256
diff
changeset
|
2191 |
} |
5949904cf955
Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents:
7256
diff
changeset
|
2192 |
|
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2193 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2194 |
AnimationInterface::WriteXmlP (uint64_t animUid, std::string pktType, uint32_t tId, double fbRx, double lbRx) |
7360
5949904cf955
Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents:
7256
diff
changeset
|
2195 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2196 |
AnimXmlElement element (pktType); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2197 |
element.AddAttribute ("uId", animUid); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2198 |
element.AddAttribute ("tId", tId); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2199 |
element.AddAttribute ("fbRx", fbRx); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2200 |
element.AddAttribute ("lbRx", lbRx); |
11618
1de158f7e17a
Bug 2170 - AnimationInterface outputs improperly formed XML
miilic
parents:
11430
diff
changeset
|
2201 |
element.CloseElement (); |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2202 |
WriteN (element.GetElementString (), m_f); |
7360
5949904cf955
Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents:
7256
diff
changeset
|
2203 |
} |
5949904cf955
Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents:
7256
diff
changeset
|
2204 |
|
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2205 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2206 |
AnimationInterface::WriteXmlP (std::string pktType, uint32_t fId, double fbTx, double lbTx, |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2207 |
uint32_t tId, double fbRx, double lbRx, std::string metaInfo) |
7769
ccd721b6a755
NetAnim: enable packet meta data
John Abraham <john.abraham@gatech.edu>
parents:
7766
diff
changeset
|
2208 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2209 |
AnimXmlElement element (pktType); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2210 |
element.AddAttribute ("fId", fId); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2211 |
element.AddAttribute ("fbTx", fbTx); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2212 |
element.AddAttribute ("lbTx", lbTx); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2213 |
if (!metaInfo.empty ()) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2214 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2215 |
element.AddAttribute ("meta-info", metaInfo.c_str ()); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2216 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2217 |
element.AddAttribute ("tId", tId); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2218 |
element.AddAttribute ("fbRx", fbRx); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2219 |
element.AddAttribute ("lbRx", lbRx); |
11618
1de158f7e17a
Bug 2170 - AnimationInterface outputs improperly formed XML
miilic
parents:
11430
diff
changeset
|
2220 |
element.CloseElement (); |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2221 |
WriteN (element.GetElementString (), m_f); |
7769
ccd721b6a755
NetAnim: enable packet meta data
John Abraham <john.abraham@gatech.edu>
parents:
7766
diff
changeset
|
2222 |
} |
ccd721b6a755
NetAnim: enable packet meta data
John Abraham <john.abraham@gatech.edu>
parents:
7766
diff
changeset
|
2223 |
|
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2224 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2225 |
AnimationInterface::WriteXmlAddNodeCounter (uint32_t nodeCounterId, std::string counterName, CounterType counterType) |
10568
c2276139e20a
NetAnim: Implement Node Counter
John Abraham <john.abraham.in@gmail.com>
parents:
10562
diff
changeset
|
2226 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2227 |
AnimXmlElement element ("ncs"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2228 |
element.AddAttribute ("ncId", nodeCounterId); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2229 |
element.AddAttribute ("n", counterName); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2230 |
element.AddAttribute ("t", CounterTypeToString (counterType)); |
11618
1de158f7e17a
Bug 2170 - AnimationInterface outputs improperly formed XML
miilic
parents:
11430
diff
changeset
|
2231 |
element.CloseElement (); |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2232 |
WriteN (element.GetElementString (), m_f); |
10560
666b4bbc0348
NetAnim: Enable transition to 3.105
John Abraham <john.abraham.in@gmail.com>
parents:
10559
diff
changeset
|
2233 |
} |
666b4bbc0348
NetAnim: Enable transition to 3.105
John Abraham <john.abraham.in@gmail.com>
parents:
10559
diff
changeset
|
2234 |
|
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2235 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2236 |
AnimationInterface::WriteXmlAddResource (uint32_t resourceId, std::string resourcePath) |
10560
666b4bbc0348
NetAnim: Enable transition to 3.105
John Abraham <john.abraham.in@gmail.com>
parents:
10559
diff
changeset
|
2237 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2238 |
AnimXmlElement element ("res"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2239 |
element.AddAttribute ("rid", resourceId); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2240 |
element.AddAttribute ("p", resourcePath); |
11618
1de158f7e17a
Bug 2170 - AnimationInterface outputs improperly formed XML
miilic
parents:
11430
diff
changeset
|
2241 |
element.CloseElement (); |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2242 |
WriteN (element.GetElementString (), m_f); |
10560
666b4bbc0348
NetAnim: Enable transition to 3.105
John Abraham <john.abraham.in@gmail.com>
parents:
10559
diff
changeset
|
2243 |
} |
666b4bbc0348
NetAnim: Enable transition to 3.105
John Abraham <john.abraham.in@gmail.com>
parents:
10559
diff
changeset
|
2244 |
|
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2245 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2246 |
AnimationInterface::WriteXmlUpdateNodeImage (uint32_t nodeId, uint32_t resourceId) |
10560
666b4bbc0348
NetAnim: Enable transition to 3.105
John Abraham <john.abraham.in@gmail.com>
parents:
10559
diff
changeset
|
2247 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2248 |
AnimXmlElement element ("nu"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2249 |
element.AddAttribute ("p", "i"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2250 |
element.AddAttribute ("t", Simulator::Now ().GetSeconds ()); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2251 |
element.AddAttribute ("id", nodeId); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2252 |
element.AddAttribute ("rid", resourceId); |
11618
1de158f7e17a
Bug 2170 - AnimationInterface outputs improperly formed XML
miilic
parents:
11430
diff
changeset
|
2253 |
element.CloseElement (); |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2254 |
WriteN (element.GetElementString (), m_f); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2255 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2256 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2257 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2258 |
AnimationInterface::WriteXmlUpdateNodeSize (uint32_t nodeId, double width, double height) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2259 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2260 |
AnimXmlElement element ("nu"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2261 |
element.AddAttribute ("p", "s"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2262 |
element.AddAttribute ("t", Simulator::Now ().GetSeconds ()); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2263 |
element.AddAttribute ("id", nodeId); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2264 |
element.AddAttribute ("w", width); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2265 |
element.AddAttribute ("h", height); |
11618
1de158f7e17a
Bug 2170 - AnimationInterface outputs improperly formed XML
miilic
parents:
11430
diff
changeset
|
2266 |
element.CloseElement (); |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2267 |
WriteN (element.GetElementString (), m_f); |
10560
666b4bbc0348
NetAnim: Enable transition to 3.105
John Abraham <john.abraham.in@gmail.com>
parents:
10559
diff
changeset
|
2268 |
} |
666b4bbc0348
NetAnim: Enable transition to 3.105
John Abraham <john.abraham.in@gmail.com>
parents:
10559
diff
changeset
|
2269 |
|
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2270 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2271 |
AnimationInterface::WriteXmlUpdateNodePosition (uint32_t nodeId, double x, double y) |
10560
666b4bbc0348
NetAnim: Enable transition to 3.105
John Abraham <john.abraham.in@gmail.com>
parents:
10559
diff
changeset
|
2272 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2273 |
AnimXmlElement element ("nu"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2274 |
element.AddAttribute ("p", "p"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2275 |
element.AddAttribute ("t", Simulator::Now ().GetSeconds ()); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2276 |
element.AddAttribute ("id", nodeId); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2277 |
element.AddAttribute ("x", x); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2278 |
element.AddAttribute ("y", y); |
11618
1de158f7e17a
Bug 2170 - AnimationInterface outputs improperly formed XML
miilic
parents:
11430
diff
changeset
|
2279 |
element.CloseElement (); |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2280 |
WriteN (element.GetElementString (), m_f); |
10560
666b4bbc0348
NetAnim: Enable transition to 3.105
John Abraham <john.abraham.in@gmail.com>
parents:
10559
diff
changeset
|
2281 |
} |
666b4bbc0348
NetAnim: Enable transition to 3.105
John Abraham <john.abraham.in@gmail.com>
parents:
10559
diff
changeset
|
2282 |
|
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2283 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2284 |
AnimationInterface::WriteXmlUpdateNodeColor (uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b) |
10560
666b4bbc0348
NetAnim: Enable transition to 3.105
John Abraham <john.abraham.in@gmail.com>
parents:
10559
diff
changeset
|
2285 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2286 |
AnimXmlElement element ("nu"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2287 |
element.AddAttribute ("p", "c"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2288 |
element.AddAttribute ("t", Simulator::Now ().GetSeconds ()); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2289 |
element.AddAttribute ("id", nodeId); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2290 |
element.AddAttribute ("r", (uint32_t) r); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2291 |
element.AddAttribute ("g", (uint32_t) g); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2292 |
element.AddAttribute ("b", (uint32_t) b); |
11618
1de158f7e17a
Bug 2170 - AnimationInterface outputs improperly formed XML
miilic
parents:
11430
diff
changeset
|
2293 |
element.CloseElement (); |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2294 |
WriteN (element.GetElementString (), m_f); |
10560
666b4bbc0348
NetAnim: Enable transition to 3.105
John Abraham <john.abraham.in@gmail.com>
parents:
10559
diff
changeset
|
2295 |
} |
666b4bbc0348
NetAnim: Enable transition to 3.105
John Abraham <john.abraham.in@gmail.com>
parents:
10559
diff
changeset
|
2296 |
|
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2297 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2298 |
AnimationInterface::WriteXmlUpdateNodeDescription (uint32_t nodeId) |
10560
666b4bbc0348
NetAnim: Enable transition to 3.105
John Abraham <john.abraham.in@gmail.com>
parents:
10559
diff
changeset
|
2299 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2300 |
AnimXmlElement element ("nu"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2301 |
element.AddAttribute ("p", "d"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2302 |
element.AddAttribute ("t", Simulator::Now ().GetSeconds ()); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2303 |
element.AddAttribute ("id", nodeId); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2304 |
if (m_nodeDescriptions.find (nodeId) != m_nodeDescriptions.end ()) |
10560
666b4bbc0348
NetAnim: Enable transition to 3.105
John Abraham <john.abraham.in@gmail.com>
parents:
10559
diff
changeset
|
2305 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2306 |
element.AddAttribute ("descr", m_nodeDescriptions[nodeId]); |
10560
666b4bbc0348
NetAnim: Enable transition to 3.105
John Abraham <john.abraham.in@gmail.com>
parents:
10559
diff
changeset
|
2307 |
} |
11618
1de158f7e17a
Bug 2170 - AnimationInterface outputs improperly formed XML
miilic
parents:
11430
diff
changeset
|
2308 |
element.CloseElement (); |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2309 |
WriteN (element.GetElementString (), m_f); |
10560
666b4bbc0348
NetAnim: Enable transition to 3.105
John Abraham <john.abraham.in@gmail.com>
parents:
10559
diff
changeset
|
2310 |
} |
666b4bbc0348
NetAnim: Enable transition to 3.105
John Abraham <john.abraham.in@gmail.com>
parents:
10559
diff
changeset
|
2311 |
|
10568
c2276139e20a
NetAnim: Implement Node Counter
John Abraham <john.abraham.in@gmail.com>
parents:
10562
diff
changeset
|
2312 |
|
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2313 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2314 |
AnimationInterface::WriteXmlUpdateNodeCounter (uint32_t nodeCounterId, uint32_t nodeId, double counterValue) |
10561
d8744f535ed9
NetAnim: Add SetBackgroundImage
John Abraham <john.abraham.in@gmail.com>
parents:
10560
diff
changeset
|
2315 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2316 |
AnimXmlElement element ("nc"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2317 |
element.AddAttribute ("c", nodeCounterId); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2318 |
element.AddAttribute ("i", nodeId); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2319 |
element.AddAttribute ("t", Simulator::Now ().GetSeconds ()); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2320 |
element.AddAttribute ("v", counterValue); |
11618
1de158f7e17a
Bug 2170 - AnimationInterface outputs improperly formed XML
miilic
parents:
11430
diff
changeset
|
2321 |
element.CloseElement (); |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2322 |
WriteN (element.GetElementString (), m_f); |
9109
a09a1899429d
NetAnim: Add support for ipv4 address printing for non-p2p
John Abraham <john.abraham.in@gmail.com>
parents:
9108
diff
changeset
|
2323 |
} |
a09a1899429d
NetAnim: Add support for ipv4 address printing for non-p2p
John Abraham <john.abraham.in@gmail.com>
parents:
9108
diff
changeset
|
2324 |
|
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2325 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2326 |
AnimationInterface::WriteXmlUpdateBackground (std::string fileName, double x, double y, double scaleX, double scaleY, double opacity) |
7360
5949904cf955
Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents:
7256
diff
changeset
|
2327 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2328 |
AnimXmlElement element ("bg"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2329 |
element.AddAttribute ("f", fileName); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2330 |
element.AddAttribute ("x", x); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2331 |
element.AddAttribute ("y", y); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2332 |
element.AddAttribute ("sx", scaleX); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2333 |
element.AddAttribute ("sy", scaleY); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2334 |
element.AddAttribute ("o", opacity); |
11618
1de158f7e17a
Bug 2170 - AnimationInterface outputs improperly formed XML
miilic
parents:
11430
diff
changeset
|
2335 |
element.CloseElement (); |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2336 |
WriteN (element.GetElementString (), m_f); |
7360
5949904cf955
Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents:
7256
diff
changeset
|
2337 |
} |
5949904cf955
Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents:
7256
diff
changeset
|
2338 |
|
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2339 |
void |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2340 |
AnimationInterface::WriteXmlNonP2pLinkProperties (uint32_t id, std::string ipv4Address, std::string channelType) |
10485
83fc28889371
Added remaining energy tracing (Task #4593)
Evgeny Kalishenko <ydginster@gmail.com>
parents:
10197
diff
changeset
|
2341 |
{ |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2342 |
AnimXmlElement element ("nonp2plinkproperties"); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2343 |
element.AddAttribute ("id", id); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2344 |
element.AddAttribute ("ipv4Address", ipv4Address); |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2345 |
element.AddAttribute ("channelType", channelType); |
11618
1de158f7e17a
Bug 2170 - AnimationInterface outputs improperly formed XML
miilic
parents:
11430
diff
changeset
|
2346 |
element.CloseElement (); |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2347 |
WriteN (element.GetElementString (), m_f); |
10485
83fc28889371
Added remaining energy tracing (Task #4593)
Evgeny Kalishenko <ydginster@gmail.com>
parents:
10197
diff
changeset
|
2348 |
} |
83fc28889371
Added remaining energy tracing (Task #4593)
Evgeny Kalishenko <ydginster@gmail.com>
parents:
10197
diff
changeset
|
2349 |
|
7362
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2350 |
TypeId |
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2351 |
AnimByteTag::GetTypeId (void) |
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2352 |
{ |
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2353 |
static TypeId tid = TypeId ("ns3::AnimByteTag") |
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2354 |
.SetParent<Tag> () |
11267
70a5e6c2feae
SetGroupName for netanim module
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11224
diff
changeset
|
2355 |
.SetGroupName ("NetAnim") |
7362
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2356 |
.AddConstructor<AnimByteTag> () |
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2357 |
; |
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2358 |
return tid; |
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2359 |
} |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2360 |
|
7362
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2361 |
TypeId |
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2362 |
AnimByteTag::GetInstanceTypeId (void) const |
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2363 |
{ |
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2364 |
return GetTypeId (); |
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2365 |
} |
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2366 |
|
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2367 |
uint32_t |
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2368 |
AnimByteTag::GetSerializedSize (void) const |
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2369 |
{ |
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2370 |
return sizeof (uint64_t); |
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2371 |
} |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2372 |
|
7362
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2373 |
void |
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2374 |
AnimByteTag::Serialize (TagBuffer i) const |
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2375 |
{ |
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2376 |
i.WriteU64 (m_AnimUid); |
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2377 |
} |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2378 |
|
7362
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2379 |
void |
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2380 |
AnimByteTag::Deserialize (TagBuffer i) |
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2381 |
{ |
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2382 |
m_AnimUid = i.ReadU64 (); |
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2383 |
} |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2384 |
|
7362
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2385 |
void |
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2386 |
AnimByteTag::Print (std::ostream &os) const |
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2387 |
{ |
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2388 |
os << "AnimUid=" << m_AnimUid; |
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2389 |
} |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2390 |
|
7362
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2391 |
void |
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2392 |
AnimByteTag::Set (uint64_t AnimUid) |
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2393 |
{ |
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2394 |
m_AnimUid = AnimUid; |
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2395 |
} |
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2396 |
|
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2397 |
uint64_t |
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2398 |
AnimByteTag::Get (void) const |
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2399 |
{ |
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2400 |
return m_AnimUid; |
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2401 |
} |
36b42a8b16d1
Bug 1172 Special case handling for duplicates,forwards and some doxygen fixes
John Abraham <john.abraham@gatech.edu>
parents:
7360
diff
changeset
|
2402 |
|
10827 | 2403 |
AnimationInterface::AnimPacketInfo::AnimPacketInfo () |
2404 |
: m_txnd (0), |
|
2405 |
m_txNodeId (0), |
|
2406 |
m_fbTx (0), |
|
2407 |
m_lbTx (0), |
|
11336
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
2408 |
m_lbRx (0) |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2409 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2410 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2411 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2412 |
AnimationInterface::AnimPacketInfo::AnimPacketInfo (const AnimPacketInfo & pInfo) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2413 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2414 |
m_txnd = pInfo.m_txnd; |
10827 | 2415 |
m_txNodeId = pInfo.m_txNodeId; |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2416 |
m_fbTx = pInfo.m_fbTx; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2417 |
m_lbTx = pInfo.m_lbTx; |
11336
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
2418 |
m_lbRx = pInfo.m_lbRx; |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2419 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2420 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2421 |
AnimationInterface::AnimPacketInfo::AnimPacketInfo (Ptr <const NetDevice> txnd, |
10827 | 2422 |
const Time fbTx, |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2423 |
uint32_t txNodeId) |
10827 | 2424 |
: m_txnd (txnd), |
2425 |
m_txNodeId (0), |
|
2426 |
m_fbTx (fbTx.GetSeconds ()), |
|
11336
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
2427 |
m_lbTx (0), |
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
2428 |
m_lbRx (0) |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2429 |
{ |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2430 |
if (!m_txnd) |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2431 |
m_txNodeId = txNodeId; |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2432 |
} |
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2433 |
|
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2434 |
void |
11336
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
2435 |
AnimationInterface::AnimPacketInfo::ProcessRxBegin (Ptr<const NetDevice> nd, const double fbRx) |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2436 |
{ |
11336
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
2437 |
Ptr <Node> n = nd->GetNode (); |
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
2438 |
m_fbRx = fbRx; |
c5d56054e7d3
NetAnim: move AnimRxInfo into AnimPacketInfo, obsolete lbRx for broadcast
John Abraham
parents:
11267
diff
changeset
|
2439 |
m_rxnd = nd; |
10826
45ae1e4cbe6e
NetAnim: Cleanup and support for more built-in counters
John Abraham
parents:
10699
diff
changeset
|
2440 |
} |
7360
5949904cf955
Bug 1172 Implement trivial XML output feature for Animation Interface
John Abraham <john.abraham@gatech.edu>
parents:
7256
diff
changeset
|
2441 |
|
5776 | 2442 |
} // namespace ns3 |