NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
l2-tracer.cpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
20 #include "l2-tracer.hpp"
21 
22 #include "ns3/node.h"
23 #include "ns3/config.h"
24 #include "ns3/names.h"
25 #include "ns3/callback.h"
26 
27 #include "ns3/point-to-point-net-device.h"
28 #include "ns3/queue.h"
29 #include <boost/lexical_cast.hpp>
30 
31 namespace ns3 {
32 
33 L2Tracer::L2Tracer(Ptr<Node> node)
34  : m_nodePtr(node)
35 {
36  m_node = boost::lexical_cast<std::string>(m_nodePtr->GetId());
37 
38  Connect();
39 
40  std::string name = Names::FindName(node);
41  if (!name.empty()) {
42  m_node = name;
43  }
44 }
45 
46 void
48 {
49  for (uint32_t devId = 0; devId < m_nodePtr->GetNDevices(); devId++) {
50  Ptr<PointToPointNetDevice> p2pnd =
51  DynamicCast<PointToPointNetDevice>(m_nodePtr->GetDevice(devId));
52  if (p2pnd) {
53  p2pnd->GetQueue()->TraceConnectWithoutContext("Drop", MakeCallback(&L2Tracer::Drop, this));
54  }
55  }
56 }
57 
58 } // namespace ns3
Ptr< Node > m_nodePtr
Definition: l2-tracer.hpp:61
void Connect()
Definition: l2-tracer.cpp:47
std::string m_node
Definition: l2-tracer.hpp:60
Copyright (c) 2011-2015 Regents of the University of California.
virtual void Drop(Ptr< const Packet >)=0
L2Tracer(Ptr< Node > node)
Definition: l2-tracer.cpp:33