NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: 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 
65  // satisfied/timed out PIs
66  l3->TraceConnectWithoutContext("SatisfiedInterests",
67  MakeCallback(&L3Tracer::SatisfiedInterests, this));
68 
69  l3->TraceConnectWithoutContext("TimedOutInterests",
70  MakeCallback(&L3Tracer::TimedOutInterests, this));
71 }
72 
73 } // namespace ndn
74 } // namespace ns3
Copyright (c) 2011-2015 Regents of the University of California.
virtual void SatisfiedInterests(const nfd::pit::Entry &, const Face &, const Data &)=0
virtual ~L3Tracer()
Destructor.
L3Tracer(Ptr< Node > node)
Trace constructor that attaches to the node using node pointer.
Copyright (c) 2011-2015 Regents of the University of California.
virtual void OutData(const Data &, const Face &)=0
Implementation network-layer of NDN stack.
virtual void InInterests(const Interest &, const Face &)=0
virtual void InData(const Data &, const Face &)=0
virtual void TimedOutInterests(const nfd::pit::Entry &)=0
virtual void OutInterests(const Interest &, const Face &)=0