NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
ndn-l3-tracer.cpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
20 #include "ndn-l3-tracer.hpp"
21 #include "ns3/node.h"
22 #include "ns3/packet.h"
23 #include "ns3/config.h"
24 #include "ns3/names.h"
25 #include "ns3/callback.h"
26 
27 #include <boost/lexical_cast.hpp>
28 
29 #include "ns3/ndnSIM/model/ndn-l3-protocol.hpp"
30 
31 namespace ns3 {
32 namespace ndn {
33 
34 L3Tracer::L3Tracer(Ptr<Node> node)
35  : m_nodePtr(node)
36 {
37  m_node = boost::lexical_cast<std::string>(m_nodePtr->GetId());
38 
39  Connect();
40 
41  std::string name = Names::FindName(node);
42  if (!name.empty()) {
43  m_node = name;
44  }
45 }
46 
47 L3Tracer::L3Tracer(const std::string& node)
48  : m_node(node)
49 {
50  Connect();
51 }
52 
54 
55 void
57 {
58  Ptr<L3Protocol> l3 = m_nodePtr->GetObject<L3Protocol>();
59 
60  l3->TraceConnectWithoutContext("OutInterests", MakeCallback(&L3Tracer::OutInterests, this));
61  l3->TraceConnectWithoutContext("InInterests", MakeCallback(&L3Tracer::InInterests, this));
62  l3->TraceConnectWithoutContext("OutData", MakeCallback(&L3Tracer::OutData, this));
63  l3->TraceConnectWithoutContext("InData", MakeCallback(&L3Tracer::InData, this));
64  l3->TraceConnectWithoutContext("OutNack", MakeCallback(&L3Tracer::OutNack, this));
65  l3->TraceConnectWithoutContext("InNack", MakeCallback(&L3Tracer::InNack, this));
66 
67  // satisfied/timed out PIs
68  l3->TraceConnectWithoutContext("SatisfiedInterests",
69  MakeCallback(&L3Tracer::SatisfiedInterests, this));
70 
71  l3->TraceConnectWithoutContext("TimedOutInterests",
72  MakeCallback(&L3Tracer::TimedOutInterests, this));
73 }
74 
75 } // namespace ndn
76 } // namespace ns3
ns3
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-app-link-service.cpp:32
ns3::ndn::L3Tracer::OutData
virtual void OutData(const Data &, const Face &)=0
ns3::ndn::L3Tracer::InInterests
virtual void InInterests(const Interest &, const Face &)=0
ns3::ndn::L3Tracer::m_nodePtr
Ptr< Node > m_nodePtr
Definition: ndn-l3-tracer.hpp:105
ns3::ndn::L3Tracer::InData
virtual void InData(const Data &, const Face &)=0
ns3::ndn::L3Tracer::OutInterests
virtual void OutInterests(const Interest &, const Face &)=0
ns3::ndn::L3Tracer::TimedOutInterests
virtual void TimedOutInterests(const nfd::pit::Entry &)=0
ns3::ndn::L3Tracer::m_node
std::string m_node
Definition: ndn-l3-tracer.hpp:104
ns3::ndn::L3Tracer::Connect
void Connect()
Definition: ndn-l3-tracer.cpp:56
ns3::ndn::L3Tracer::SatisfiedInterests
virtual void SatisfiedInterests(const nfd::pit::Entry &, const Face &, const Data &)=0
ndn::name
Definition: name-component-types.hpp:33
ns3::ndn::L3Protocol
Implementation network-layer of NDN stack.
Definition: ndn-l3-protocol.hpp:81
ns3::ndn::L3Tracer::InNack
virtual void InNack(const lp::Nack &, const Face &)=0
ns3::ndn::L3Tracer::OutNack
virtual void OutNack(const lp::Nack &nack, const Face &)=0
ns3::ndn::L3Tracer::L3Tracer
L3Tracer(Ptr< Node > node)
Trace constructor that attaches to the node using node pointer.
Definition: ndn-l3-tracer.cpp:34
ndn-l3-tracer.hpp
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-strategy-choice-helper.hpp:34
ns3::ndn::L3Tracer::~L3Tracer
virtual ~L3Tracer()
Destructor.
Definition: ndn-l3-tracer.cpp:53