View | Details | Raw Unified | Return to bug 652
Collapse All | Expand All

(-)a/src/internet/helper/ipv4-routing-helper.cc (+93 lines)
 Lines 23-28    Link Here 
23
#include "ns3/simulator.h"
23
#include "ns3/simulator.h"
24
#include "ns3/ipv4-routing-protocol.h"
24
#include "ns3/ipv4-routing-protocol.h"
25
#include "ns3/ipv4-list-routing.h"
25
#include "ns3/ipv4-list-routing.h"
26
#include "ns3/ipv4-l3-protocol.h"
27
#include "ns3/ipv4-interface.h"
28
#include "ns3/arp-cache.h"
29
#include "ns3/names.h"
26
#include "ipv4-routing-helper.h"
30
#include "ipv4-routing-helper.h"
27
31
28
namespace ns3 {
32
namespace ns3 {
 Lines 82-85    Link Here 
82
  Simulator::Schedule (printInterval, &Ipv4RoutingHelper::PrintEvery, this, printInterval, node, stream);
86
  Simulator::Schedule (printInterval, &Ipv4RoutingHelper::PrintEvery, this, printInterval, node, stream);
83
}
87
}
84
88
89
void
90
Ipv4RoutingHelper::PrintNeighborCacheAllAt (Time printTime, Ptr<OutputStreamWrapper> stream) const
91
{
92
  for (uint32_t i = 0; i < NodeList::GetNNodes (); i++)
93
    {
94
      Ptr<Node> node = NodeList::GetNode (i);
95
      Simulator::Schedule (printTime, &Ipv4RoutingHelper::PrintArpCache, this, node, stream);
96
    }
97
}
98
99
void
100
Ipv4RoutingHelper::PrintNeighborCacheAllEvery (Time printInterval, Ptr<OutputStreamWrapper> stream) const
101
{
102
  for (uint32_t i = 0; i < NodeList::GetNNodes (); i++)
103
    {
104
      Ptr<Node> node = NodeList::GetNode (i);
105
      Simulator::Schedule (printInterval, &Ipv4RoutingHelper::PrintArpCacheEvery, this, printInterval, node, stream);
106
    }
107
}
108
109
void
110
Ipv4RoutingHelper::PrintNeighborCacheAt (Time printTime, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const
111
{
112
  Simulator::Schedule (printTime, &Ipv4RoutingHelper::PrintArpCache, this, node, stream);
113
}
114
115
void
116
Ipv4RoutingHelper::PrintNeighborCacheEvery (Time printInterval,Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const
117
{
118
  Simulator::Schedule (printInterval, &Ipv4RoutingHelper::PrintArpCacheEvery, this, printInterval, node, stream);
119
}
120
121
void
122
Ipv4RoutingHelper::PrintArpCache (Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const
123
{
124
  std::ostream* os = stream->GetStream ();
125
126
  *os << "ARP Cache of node ";
127
  std::string found = Names::FindName (node);
128
  if (Names::FindName (node) != "")
129
    {
130
      *os << found;
131
    }
132
  else
133
    {
134
      *os << static_cast<int> (node->GetId ());
135
    }
136
  *os << " at time " << Simulator::Now ().GetSeconds () << "\n";
137
138
  Ptr<Ipv4L3Protocol> ipv4 = node->GetObject<Ipv4L3Protocol> ();
139
  for (uint32_t i=0; i<ipv4->GetNInterfaces(); i++)
140
    {
141
      Ptr<ArpCache> arpCache = ipv4->GetInterface (i)->GetArpCache ();
142
      if (arpCache)
143
        {
144
          arpCache->PrintArpCache (stream);
145
        }
146
    }
147
}
148
149
void
150
Ipv4RoutingHelper::PrintArpCacheEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const
151
{
152
  std::ostream* os = stream->GetStream ();
153
154
  *os << "ARP Cache of node ";
155
  std::string found = Names::FindName (node);
156
  if (Names::FindName (node) != "")
157
    {
158
      *os << found;
159
    }
160
  else
161
    {
162
      *os << static_cast<int> (node->GetId ());
163
    }
164
  *os << " at time " << Simulator::Now ().GetSeconds () << "\n";
165
166
  Ptr<Ipv4L3Protocol> ipv4 = node->GetObject<Ipv4L3Protocol> ();
167
  for (uint32_t i=0; i<ipv4->GetNInterfaces(); i++)
168
    {
169
      Ptr<ArpCache> arpCache = ipv4->GetInterface (i)->GetArpCache ();
170
      if (arpCache)
171
        {
172
          arpCache->PrintArpCache (stream);
173
        }
174
    }
175
  Simulator::Schedule (printInterval, &Ipv4RoutingHelper::PrintArpCacheEvery, this, printInterval, node, stream);
176
}
177
85
} // namespace ns3
178
} // namespace ns3
(-)a/src/internet/helper/ipv4-routing-helper.h (-2 / +99 lines)
 Lines 110-115    Link Here 
110
  void PrintRoutingTableEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
110
  void PrintRoutingTableEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
111
111
112
  /**
112
  /**
113
   * \brief prints the neighbor cache of all nodes at a particular time.
114
   * \param printTime the time at which the neighbor cache is supposed to be printed.
115
   * \param stream The output stream object to use
116
   *
117
   * This method calls the PrintArpCache() method of the
118
   * ArpCache associated with each Ipv4Interface stored in the Ipv4 object, for all nodes at the
119
   * specified time. The output format is similar to:
120
   * \verbatim
121
     10.1.1.2 dev 1 lladdr 00-06-00:00:00:00:00:02 REACHABLE
122
     \endverbatim
123
   * Note that the MAC address is printed as "type"-"size"-"actual address"
124
   */
125
  void PrintNeighborCacheAllAt (Time printTime, Ptr<OutputStreamWrapper> stream) const;
126
127
  /**
128
   * \brief prints the neighbor cache of all nodes at regular intervals specified by user.
129
   * \param printInterval the time interval for which the neighbor cache is supposed to be printed.
130
   * \param stream The output stream object to use
131
   *
132
   * This method calls the PrintArpCache() method of the
133
   * ArpCache associated with each Ipv4Interface stored in the Ipv4 object, for all nodes at the
134
   * specified time. The output format is similar to:
135
   * \verbatim
136
     10.1.1.2 dev 1 lladdr 00-06-00:00:00:00:00:02 REACHABLE
137
     \endverbatim
138
   * Note that the MAC address is printed as "type"-"size"-"actual address"
139
   */
140
  void PrintNeighborCacheAllEvery (Time printInterval, Ptr<OutputStreamWrapper> stream) const;
141
142
  /**
143
   * \brief prints the neighbor cache of a node at a particular time.
144
   * \param printTime the time at which the neighbor cache is supposed to be printed.
145
   * \param node The node ptr for which we need the neighbor cache to be printed
146
   * \param stream The output stream object to use
147
   *
148
   * This method calls the PrintArpCache() method of the
149
   * ArpCache associated with each Ipv4Interface stored in the Ipv4 object, for all nodes at the
150
   * specified time. The output format is similar to:
151
   * \verbatim
152
     10.1.1.2 dev 1 lladdr 00-06-00:00:00:00:00:02 REACHABLE
153
     \endverbatim
154
   * Note that the MAC address is printed as "type"-"size"-"actual address"
155
   */
156
  void PrintNeighborCacheAt (Time printTime, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
157
158
  /**
159
   * \brief prints the neighbor cache of a node at regular intervals specified by user.
160
   * \param printInterval the time interval for which the neighbor cache is supposed to be printed.
161
   * \param node The node ptr for which we need the neighbor cache to be printed
162
   * \param stream The output stream object to use
163
   *
164
   * This method calls the PrintArpCache() method of the
165
   * ArpCache associated with each Ipv4Interface stored in the Ipv4 object, for all nodes at the
166
   * specified time. The output format is similar to:
167
   * \verbatim
168
     10.1.1.2 dev 1 lladdr 00-06-00:00:00:00:00:02 REACHABLE
169
     \endverbatim
170
   * Note that the MAC address is printed as "type"-"size"-"actual address"
171
   */
172
   void PrintNeighborCacheEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
173
174
  /**
113
   * \brief Request a specified routing protocol &lt;T&gt; from Ipv4RoutingProtocol protocol
175
   * \brief Request a specified routing protocol &lt;T&gt; from Ipv4RoutingProtocol protocol
114
   *
176
   *
115
   * If protocol is Ipv4ListRouting, then protocol will be searched in the list,
177
   * If protocol is Ipv4ListRouting, then protocol will be searched in the list,
 Lines 130-136    Link Here 
130
   * \param stream The output stream object to use
192
   * \param stream The output stream object to use
131
   *
193
   *
132
   * This method calls the PrintRoutingTable() method of the
194
   * This method calls the PrintRoutingTable() method of the
133
   * Ipv6RoutingProtocol stored in the Ipv6 object;
195
   * Ipv4RoutingProtocol stored in the Ipv4 object;
134
   * the output format is routing protocol-specific.
196
   * the output format is routing protocol-specific.
135
   */
197
   */
136
  void Print (Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
198
  void Print (Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
 Lines 144-153    Link Here 
144
   * \param stream The output stream object to use
206
   * \param stream The output stream object to use
145
   *
207
   *
146
   * This method calls the PrintRoutingTable() method of the
208
   * This method calls the PrintRoutingTable() method of the
147
   * Ipv6RoutingProtocol stored in the Ipv6 object, for the selected node
209
   * Ipv4RoutingProtocol stored in the Ipv4 object, for the selected node
148
   * at the specified interval; the output format is routing protocol-specific.
210
   * at the specified interval; the output format is routing protocol-specific.
149
   */
211
   */
150
  void PrintEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
212
  void PrintEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
213
214
  /**
215
   * \internal
216
   *
217
   * \brief prints the neighbor cache of a node.
218
   * \param node The node ptr for which we need the neighbor cache to be printed
219
   * \param stream The output stream object to use
220
   *
221
   * This method calls the PrintArpCache() method of the
222
   * ArpCache associated with each Ipv4Interface stored in the Ipv4 object, for all nodes at the
223
   * specified time. The output format is similar to:
224
   * \verbatim
225
     10.1.1.2 dev 1 lladdr 00-06-00:00:00:00:00:02 REACHABLE
226
     \endverbatim
227
   * Note that the MAC address is printed as "type"-"size"-"actual address"
228
   */
229
  void PrintArpCache (Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
230
231
  /**
232
   * \internal
233
   *
234
   * \brief prints the neighbor cache of a node at regular intervals specified by user.
235
   * \param printInterval the time interval for which the neighbor cache is supposed to be printed.
236
   * \param node The node ptr for which we need the neighbor cache to be printed
237
   * \param stream The output stream object to use
238
   *
239
   * This method calls the PrintArpCache() method of the
240
   * ArpCache associated with each Ipv4Interface stored in the Ipv4 object, for all nodes at the
241
   * specified time. The output format is similar to:
242
   * \verbatim
243
     10.1.1.2 dev 1 lladdr 00-06-00:00:00:00:00:02 REACHABLE
244
     \endverbatim
245
   * Note that the MAC address is printed as "type"-"size"-"actual address"
246
   */
247
  void PrintArpCacheEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
151
};
248
};
152
249
153
250
(-)a/src/internet/helper/ipv6-routing-helper.cc (+93 lines)
 Lines 23-28    Link Here 
23
#include "ns3/simulator.h"
23
#include "ns3/simulator.h"
24
#include "ns3/ipv6-routing-protocol.h"
24
#include "ns3/ipv6-routing-protocol.h"
25
#include "ns3/ipv6-list-routing.h"
25
#include "ns3/ipv6-list-routing.h"
26
#include "ns3/ipv6-l3-protocol.h"
27
#include "ns3/ipv6-interface.h"
28
#include "ns3/ndisc-cache.h"
29
#include "ns3/names.h"
26
#include "ipv6-routing-helper.h"
30
#include "ipv6-routing-helper.h"
27
31
28
namespace ns3 {
32
namespace ns3 {
 Lines 82-85    Link Here 
82
  Simulator::Schedule (printInterval, &Ipv6RoutingHelper::PrintEvery, this, printInterval, node, stream);
86
  Simulator::Schedule (printInterval, &Ipv6RoutingHelper::PrintEvery, this, printInterval, node, stream);
83
}
87
}
84
88
89
void
90
Ipv6RoutingHelper::PrintNeighborCacheAllAt (Time printTime, Ptr<OutputStreamWrapper> stream) const
91
{
92
  for (uint32_t i = 0; i < NodeList::GetNNodes (); i++)
93
    {
94
      Ptr<Node> node = NodeList::GetNode (i);
95
      Simulator::Schedule (printTime, &Ipv6RoutingHelper::PrintNdiscCache, this, node, stream);
96
    }
97
}
98
99
void
100
Ipv6RoutingHelper::PrintNeighborCacheAllEvery (Time printInterval, Ptr<OutputStreamWrapper> stream) const
101
{
102
  for (uint32_t i = 0; i < NodeList::GetNNodes (); i++)
103
    {
104
      Ptr<Node> node = NodeList::GetNode (i);
105
      Simulator::Schedule (printInterval, &Ipv6RoutingHelper::PrintNdiscCacheEvery, this, printInterval, node, stream);
106
    }
107
}
108
109
void
110
Ipv6RoutingHelper::PrintNeighborCacheAt (Time printTime, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const
111
{
112
  Simulator::Schedule (printTime, &Ipv6RoutingHelper::PrintNdiscCache, this, node, stream);
113
}
114
115
void
116
Ipv6RoutingHelper::PrintNeighborCacheEvery (Time printInterval,Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const
117
{
118
  Simulator::Schedule (printInterval, &Ipv6RoutingHelper::PrintNdiscCacheEvery, this, printInterval, node, stream);
119
}
120
121
void
122
Ipv6RoutingHelper::PrintNdiscCache (Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const
123
{
124
  std::ostream* os = stream->GetStream ();
125
126
  *os << "NDISC Cache of node ";
127
  std::string found = Names::FindName (node);
128
  if (Names::FindName (node) != "")
129
    {
130
      *os << found;
131
    }
132
  else
133
    {
134
      *os << static_cast<int> (node->GetId ());
135
    }
136
  *os << " at time " << Simulator::Now ().GetSeconds () << "\n";
137
138
  Ptr<Ipv6L3Protocol> ipv6 = node->GetObject<Ipv6L3Protocol> ();
139
  for (uint32_t i=0; i<ipv6->GetNInterfaces(); i++)
140
    {
141
      Ptr<NdiscCache> ndiscCache = ipv6->GetInterface (i)->GetNdiscCache ();
142
      if (ndiscCache)
143
        {
144
          ndiscCache->PrintNdiscCache (stream);
145
        }
146
    }
147
}
148
149
void
150
Ipv6RoutingHelper::PrintNdiscCacheEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const
151
{
152
  std::ostream* os = stream->GetStream ();
153
154
  *os << "NDISC Cache of node ";
155
  std::string found = Names::FindName (node);
156
  if (Names::FindName (node) != "")
157
    {
158
      *os << found;
159
    }
160
  else
161
    {
162
      *os << static_cast<int> (node->GetId ());
163
    }
164
  *os << " at time " << Simulator::Now ().GetSeconds () << "\n";
165
166
  Ptr<Ipv6L3Protocol> ipv6 = node->GetObject<Ipv6L3Protocol> ();
167
  for (uint32_t i=0; i<ipv6->GetNInterfaces(); i++)
168
    {
169
      Ptr<NdiscCache> ndiscCache = ipv6->GetInterface (i)->GetNdiscCache ();
170
      if (ndiscCache)
171
        {
172
          ndiscCache->PrintNdiscCache (stream);
173
        }
174
    }
175
  Simulator::Schedule (printInterval, &Ipv6RoutingHelper::PrintNdiscCacheEvery, this, printInterval, node, stream);
176
}
177
85
} // namespace ns3
178
} // namespace ns3
(-)a/src/internet/helper/ipv6-routing-helper.h (+97 lines)
 Lines 112-117    Link Here 
112
  void PrintRoutingTableEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
112
  void PrintRoutingTableEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
113
113
114
  /**
114
  /**
115
   * \brief prints the neighbor cache of all nodes at a particular time.
116
   * \param printTime the time at which the neighbor cache is supposed to be printed.
117
   * \param stream The output stream object to use
118
   *
119
   * This method calls the PrintNdiscCache() method of the
120
   * NdiscCache associated with each Ipv6Interface stored in the Ipv6 object, for all nodes at the
121
   * specified time. The output format is similar to:
122
   * \verbatim
123
     2001:db8::f00d:beef:cafe dev 1 lladdr 00-06-00:00:00:00:00:02 REACHABLE
124
     \endverbatim
125
   * Note that the MAC address is printed as "type"-"size"-"actual address"
126
   */
127
  void PrintNeighborCacheAllAt (Time printTime, Ptr<OutputStreamWrapper> stream) const;
128
129
  /**
130
   * \brief prints the neighbor cache of all nodes at regular intervals specified by user.
131
   * \param printInterval the time interval for which the neighbor cache is supposed to be printed.
132
   * \param stream The output stream object to use
133
   *
134
   * This method calls the PrintNdiscCache() method of the
135
   * NdiscCache associated with each Ipv6Interface stored in the Ipv6 object, for all nodes at the
136
   * specified time. The output format is similar to:
137
   * \verbatim
138
     2001:db8::f00d:beef:cafe dev 1 lladdr 00-06-00:00:00:00:00:02 REACHABLE
139
     \endverbatim
140
   * Note that the MAC address is printed as "type"-"size"-"actual address"
141
   */
142
  void PrintNeighborCacheAllEvery (Time printInterval, Ptr<OutputStreamWrapper> stream) const;
143
144
  /**
145
   * \brief prints the neighbor cache of a node at a particular time.
146
   * \param printTime the time at which the neighbor cache is supposed to be printed.
147
   * \param node The node ptr for which we need the neighbor cache to be printed
148
   * \param stream The output stream object to use
149
   *
150
   * This method calls the PrintNdiscCache() method of the
151
   * NdiscCache associated with each Ipv6Interface stored in the Ipv6 object, for all nodes at the
152
   * specified time. The output format is similar to:
153
   * \verbatim
154
     2001:db8::f00d:beef:cafe dev 1 lladdr 00-06-00:00:00:00:00:02 REACHABLE
155
     \endverbatim
156
   * Note that the MAC address is printed as "type"-"size"-"actual address"
157
   */
158
  void PrintNeighborCacheAt (Time printTime, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
159
160
  /**
161
   * \brief prints the neighbor cache of a node at regular intervals specified by user.
162
   * \param printInterval the time interval for which the neighbor cache is supposed to be printed.
163
   * \param node The node ptr for which we need the neighbor cache to be printed
164
   * \param stream The output stream object to use
165
   *
166
   * This method calls the PrintNdiscCache() method of the
167
   * NdiscCache associated with each Ipv6Interface stored in the Ipv6 object, for all nodes at the
168
   * specified time. The output format is similar to:
169
   * \verbatim
170
     2001:db8::f00d:beef:cafe dev 1 lladdr 00-06-00:00:00:00:00:02 REACHABLE
171
     \endverbatim
172
   * Note that the MAC address is printed as "type"-"size"-"actual address"
173
   */
174
   void PrintNeighborCacheEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
175
176
  /**
115
   * \brief Request a specified routing protocol &lt;T&gt; from Ipv6RoutingProtocol protocol
177
   * \brief Request a specified routing protocol &lt;T&gt; from Ipv6RoutingProtocol protocol
116
   *
178
   *
117
   * If protocol is Ipv6ListRouting, then protocol will be searched in the list,
179
   * If protocol is Ipv6ListRouting, then protocol will be searched in the list,
 Lines 150-155    Link Here 
150
   * at the specified interval; the output format is routing protocol-specific.
212
   * at the specified interval; the output format is routing protocol-specific.
151
   */
213
   */
152
  void PrintEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
214
  void PrintEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
215
216
  /**
217
   * \internal
218
   *
219
   * \brief prints the neighbor cache of a node.
220
   * \param node The node ptr for which we need the neighbor cache to be printed
221
   * \param stream The output stream object to use
222
   *
223
   * This method calls the PrintNdiscCache() method of the
224
   * NdiscCache associated with each Ipv6Interface stored in the Ipv6 object, for all nodes at the
225
   * specified time. The output format is similar to:
226
   * \verbatim
227
     2001:db8::f00d:beef:cafe dev 1 lladdr 00-06-00:00:00:00:00:02 REACHABLE
228
     \endverbatim
229
   * Note that the MAC address is printed as "type"-"size"-"actual address"
230
   */
231
  void PrintNdiscCache (Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
232
233
  /**
234
   * \internal
235
   *
236
   * \brief prints the neighbor cache of a node at regular intervals specified by user.
237
   * \param printInterval the time interval for which the neighbor cache is supposed to be printed.
238
   * \param node The node ptr for which we need the neighbor cache to be printed
239
   * \param stream The output stream object to use
240
   *
241
   * This method calls the PrintNdiscCache() method of the
242
   * NdiscCache associated with each Ipv6Interface stored in the Ipv6 object, for all nodes at the
243
   * specified time. The output format is similar to:
244
   * \verbatim
245
     2001:db8::f00d:beef:cafe dev 1 lladdr 00-06-00:00:00:00:00:02 REACHABLE
246
     \endverbatim
247
   * Note that the MAC address is printed as "type"-"size"-"actual address"
248
   */
249
  void PrintNdiscCacheEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
153
};
250
};
154
251
155
/**
252
/**
(-)a/src/internet/model/arp-cache.cc (+37 lines)
 Lines 24-29    Link Here 
24
#include "ns3/log.h"
24
#include "ns3/log.h"
25
#include "ns3/node.h"
25
#include "ns3/node.h"
26
#include "ns3/trace-source-accessor.h"
26
#include "ns3/trace-source-accessor.h"
27
#include "ns3/names.h"
27
28
28
#include "arp-cache.h"
29
#include "arp-cache.h"
29
#include "arp-header.h"
30
#include "arp-header.h"
 Lines 242-247    Link Here 
242
    }
243
    }
243
}
244
}
244
245
246
void
247
ArpCache::PrintArpCache (Ptr<OutputStreamWrapper> stream)
248
{
249
  NS_LOG_FUNCTION (this << stream);
250
  std::ostream* os = stream->GetStream ();
251
252
  for (CacheI i = m_arpCache.begin (); i != m_arpCache.end (); i++)
253
    {
254
      *os << i->first << " dev ";
255
      std::string found = Names::FindName (m_device);
256
      if (Names::FindName (m_device) != "")
257
        {
258
          *os << found;
259
        }
260
      else
261
        {
262
          *os << static_cast<int> (m_device->GetIfIndex ());
263
        }
264
265
      *os << " lladdr " << i->second->GetMacAddress ();
266
267
      if (i->second->IsAlive ())
268
        {
269
          *os << " REACHABLE\n";
270
        }
271
      else if (i->second->IsWaitReply ())
272
        {
273
          *os << " DELAY\n";
274
        }
275
      else
276
        {
277
          *os << " STALE\n";
278
        }
279
    }
280
}
281
245
ArpCache::Entry *
282
ArpCache::Entry *
246
ArpCache::Lookup (Ipv4Address to)
283
ArpCache::Lookup (Ipv4Address to)
247
{
284
{
(-)a/src/internet/model/arp-cache.h (-2 / +10 lines)
 Lines 33-38    Link Here 
33
#include "ns3/object.h"
33
#include "ns3/object.h"
34
#include "ns3/traced-callback.h"
34
#include "ns3/traced-callback.h"
35
#include "ns3/sgi-hashmap.h"
35
#include "ns3/sgi-hashmap.h"
36
#include "ns3/output-stream-wrapper.h"
36
37
37
namespace ns3 {
38
namespace ns3 {
38
39
 Lines 76-83    Link Here 
76
  /**
77
  /**
77
   * \brief Set the NetDevice and Ipv4Interface associated with the ArpCache
78
   * \brief Set the NetDevice and Ipv4Interface associated with the ArpCache
78
   *
79
   *
79
   * \param device The hardware NetDevice associated with this ARP chache
80
   * \param device The hardware NetDevice associated with this ARP cache
80
   * \param interface the Ipv4Interface associated with this ARP chache
81
   * \param interface the Ipv4Interface associated with this ARP cache
81
   */
82
   */
82
  void SetDevice (Ptr<NetDevice> device, Ptr<Ipv4Interface> interface);
83
  void SetDevice (Ptr<NetDevice> device, Ptr<Ipv4Interface> interface);
83
  /**
84
  /**
 Lines 155-160    Link Here 
155
  void Flush (void);
156
  void Flush (void);
156
157
157
  /**
158
  /**
159
   * \brief Print the ARP cache entries
160
   *
161
   * \param stream the ostream the ARP cache entries is printed to
162
   */
163
  void PrintArpCache (Ptr<OutputStreamWrapper> stream);
164
165
  /**
158
   * \brief A record that that holds information about an ArpCache entry
166
   * \brief A record that that holds information about an ArpCache entry
159
   */
167
   */
160
  class Entry {
168
  class Entry {
(-)a/src/internet/model/ipv4-interface.h (+1 lines)
 Lines 78-83    Link Here 
78
   * \returns the underlying NetDevice. This method cannot return zero.
78
   * \returns the underlying NetDevice. This method cannot return zero.
79
   */
79
   */
80
  Ptr<NetDevice> GetDevice (void) const;
80
  Ptr<NetDevice> GetDevice (void) const;
81
81
  /**
82
  /**
82
   * \return ARP cache used by this interface
83
   * \return ARP cache used by this interface
83
   */
84
   */
(-)a/src/internet/model/ipv6-interface.cc (+6 lines)
 Lines 505-509    Link Here 
505
  /* not found, maybe address has expired */
505
  /* not found, maybe address has expired */
506
}
506
}
507
507
508
Ptr<NdiscCache> Ipv6Interface::GetNdiscCache () const
509
{
510
  NS_LOG_FUNCTION (this);
511
  return m_ndCache;
512
}
513
508
} /* namespace ns3 */
514
} /* namespace ns3 */
509
515
(-)a/src/internet/model/ipv6-interface.h (+6 lines)
 Lines 250-255    Link Here 
250
   */
250
   */
251
  void SetNsDadUid (Ipv6Address address, uint32_t uid);
251
  void SetNsDadUid (Ipv6Address address, uint32_t uid);
252
252
253
  /**
254
   * \return NDISC cache used by this interface
255
   */
256
  Ptr<NdiscCache> GetNdiscCache () const;
257
258
253
protected:
259
protected:
254
  /**
260
  /**
255
   * \brief Dispose this object.
261
   * \brief Dispose this object.
(-)a/src/internet/model/ndisc-cache.cc (+44 lines)
 Lines 21-26    Link Here 
21
#include "ns3/log.h"
21
#include "ns3/log.h"
22
#include "ns3/uinteger.h"
22
#include "ns3/uinteger.h"
23
#include "ns3/node.h"
23
#include "ns3/node.h"
24
#include "ns3/names.h"
24
25
25
#include "ipv6-l3-protocol.h" 
26
#include "ipv6-l3-protocol.h" 
26
#include "icmpv6-l4-protocol.h"
27
#include "icmpv6-l4-protocol.h"
 Lines 149-154    Link Here 
149
  return m_unresQlen;
150
  return m_unresQlen;
150
}
151
}
151
152
153
void NdiscCache::PrintNdiscCache (Ptr<OutputStreamWrapper> stream)
154
{
155
  NS_LOG_FUNCTION (this << stream);
156
  std::ostream* os = stream->GetStream ();
157
158
  for (CacheI i = m_ndCache.begin (); i != m_ndCache.end (); i++)
159
    {
160
      *os << i->first << " dev ";
161
      std::string found = Names::FindName (m_device);
162
      if (Names::FindName (m_device) != "")
163
        {
164
          *os << found;
165
        }
166
      else
167
        {
168
          *os << static_cast<int> (m_device->GetIfIndex ());
169
        }
170
171
      *os << " lladdr " << i->second->GetMacAddress ();
172
173
      if (i->second->IsReachable ())
174
        {
175
          *os << " REACHABLE\n";
176
        }
177
      else if (i->second->IsDelay ())
178
        {
179
          *os << " DELAY\n";
180
        }
181
      else if (i->second->IsIncomplete ())
182
        {
183
          *os << " INCOMPLETE\n";
184
        }
185
      else if (i->second->IsProbe ())
186
        {
187
          *os << " PROBE\n";
188
        }
189
      else
190
        {
191
          *os << " STALE\n";
192
        }
193
    }
194
}
195
152
NdiscCache::Entry::Entry (NdiscCache* nd)
196
NdiscCache::Entry::Entry (NdiscCache* nd)
153
  : m_ndCache (nd),
197
  : m_ndCache (nd),
154
    m_waiting (),
198
    m_waiting (),
(-)a/src/internet/model/ndisc-cache.h (-1 / +8 lines)
 Lines 22-28    Link Here 
22
#define NDISC_CACHE_H
22
#define NDISC_CACHE_H
23
23
24
#include <stdint.h>
24
#include <stdint.h>
25
26
#include <list>
25
#include <list>
27
26
28
#include "ns3/packet.h"
27
#include "ns3/packet.h"
 Lines 32-37    Link Here 
32
#include "ns3/ptr.h"
31
#include "ns3/ptr.h"
33
#include "ns3/timer.h"
32
#include "ns3/timer.h"
34
#include "ns3/sgi-hashmap.h"
33
#include "ns3/sgi-hashmap.h"
34
#include "ns3/output-stream-wrapper.h"
35
35
36
namespace ns3
36
namespace ns3
37
{
37
{
 Lines 125-130    Link Here 
125
  void SetDevice (Ptr<NetDevice> device, Ptr<Ipv6Interface> interface);
125
  void SetDevice (Ptr<NetDevice> device, Ptr<Ipv6Interface> interface);
126
126
127
  /**
127
  /**
128
   * \brief Print the NDISC cache entries
129
   *
130
   * \param stream the ostream the NDISC cache entries is printed to
131
   */
132
  void PrintNdiscCache (Ptr<OutputStreamWrapper> stream);
133
134
  /**
128
   * \class Entry
135
   * \class Entry
129
   * \brief A record that holds information about an NdiscCache entry.
136
   * \brief A record that holds information about an NdiscCache entry.
130
   */
137
   */

Return to bug 652