NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
ndn-app.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
20 #ifndef NDN_APP_H
21 #define NDN_APP_H
22 
23 #include "ns3/ndnSIM/model/ndn-common.hpp"
24 #include "ns3/ndnSIM/model/ndn-app-link-service.hpp"
25 #include "ns3/ndnSIM/NFD/daemon/face/face.hpp"
26 
27 #include "ns3/application.h"
28 #include "ns3/ptr.h"
29 #include "ns3/callback.h"
30 #include "ns3/traced-callback.h"
31 
32 namespace ns3 {
33 
34 class Packet;
35 
36 namespace ndn {
37 
48 class App : public Application {
49 public:
50  static TypeId
51  GetTypeId();
52 
56  App();
57  virtual ~App();
58 
62  uint32_t
63  GetId() const;
64 
68  virtual void
69  OnInterest(shared_ptr<const Interest> interest);
70 
74  virtual void
75  OnData(shared_ptr<const Data> data);
76 
80  virtual void
81  OnNack(shared_ptr<const lp::Nack> nack);
82 
83 public:
84  typedef void (*InterestTraceCallback)(shared_ptr<const Interest>, Ptr<App>, shared_ptr<Face>);
85  typedef void (*DataTraceCallback)(shared_ptr<const Data>, Ptr<App>, shared_ptr<Face>);
86  typedef void (*NackTraceCallback)(shared_ptr<const lp::Nack>, Ptr<App>, shared_ptr<Face>);
87 
88 protected:
89  virtual void
90  DoInitialize();
91 
92  virtual void
93  DoDispose();
94 
95  // inherited from Application base class. Originally they were private
96  virtual void
98 
99  virtual void
100  StopApplication();
101 
102 protected:
103  bool m_active;
104  shared_ptr<Face> m_face;
106 
107  uint32_t m_appId;
108 
109  TracedCallback<shared_ptr<const Interest>, Ptr<App>, shared_ptr<Face>>
111 
112  TracedCallback<shared_ptr<const Data>, Ptr<App>, shared_ptr<Face>>
114 
115  TracedCallback<shared_ptr<const lp::Nack>, Ptr<App>, shared_ptr<Face>>
117 
118  TracedCallback<shared_ptr<const Interest>, Ptr<App>, shared_ptr<Face>>
120 
121  TracedCallback<shared_ptr<const Data>, Ptr<App>, shared_ptr<Face>>
123 
124  TracedCallback<shared_ptr<const lp::Nack>, Ptr<App>, shared_ptr<Face>>
126 };
127 
128 } // namespace ndn
129 } // namespace ns3
130 
131 #endif // NDN_APP_H
ns3::ndn::AppLinkService
Implementation of LinkService for ndnSIM application.
Definition: ndn-app-link-service.hpp:42
ns3
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-app-link-service.cpp:32
ns3::ndn::App::OnData
virtual void OnData(shared_ptr< const Data > data)
Method that will be called every time new Data arrives.
Definition: ndn-app.cpp:121
ns3::ndn::App::OnNack
virtual void OnNack(shared_ptr< const lp::Nack > nack)
Method that will be called every time new Nack arrives.
Definition: ndn-app.cpp:128
ns3::ndn::App::DoDispose
virtual void DoDispose()
Definition: ndn-app.cpp:97
ns3::ndn::App::m_active
bool m_active
Flag to indicate that application is active (set by StartApplication and StopApplication)
Definition: ndn-app.hpp:103
ns3::ndn::App::m_appLink
AppLinkService * m_appLink
Definition: ndn-app.hpp:105
ns3::ndn::App::App
App()
Default constructor.
Definition: ndn-app.cpp:70
ns3::ndn::App::StartApplication
virtual void StartApplication()
Called at time specified by Start.
Definition: ndn-app.cpp:138
ns3::ndn::App::m_appId
uint32_t m_appId
Definition: ndn-app.hpp:107
ns3::ndn::App::m_receivedDatas
TracedCallback< shared_ptr< const Data >, Ptr< App >, shared_ptr< Face > > m_receivedDatas
App-level trace of received Data.
Definition: ndn-app.hpp:113
ns3::ndn::App::DoInitialize
virtual void DoInitialize()
Definition: ndn-app.cpp:82
ns3::ndn::App::OnInterest
virtual void OnInterest(shared_ptr< const Interest > interest)
Method that will be called every time new Interest arrives.
Definition: ndn-app.cpp:114
ns3::ndn::App::m_receivedNacks
TracedCallback< shared_ptr< const lp::Nack >, Ptr< App >, shared_ptr< Face > > m_receivedNacks
App-level trace of received Nacks.
Definition: ndn-app.hpp:116
ns3::ndn::App::~App
virtual ~App()
Definition: ndn-app.cpp:77
ns3::ndn::App::GetTypeId
static TypeId GetTypeId()
Definition: ndn-app.cpp:37
ns3::ndn::App
Base class that all NDN applications should be derived from.
Definition: ndn-app.hpp:48
ns3::ndn::App::GetId
uint32_t GetId() const
Get application ID (ID of applications face)
Definition: ndn-app.cpp:108
ns3::ndn::App::m_transmittedInterests
TracedCallback< shared_ptr< const Interest >, Ptr< App >, shared_ptr< Face > > m_transmittedInterests
App-level trace of transmitted Interests.
Definition: ndn-app.hpp:119
ns3::ndn::App::m_face
shared_ptr< Face > m_face
Definition: ndn-app.hpp:104
ns3::ndn::App::m_transmittedDatas
TracedCallback< shared_ptr< const Data >, Ptr< App >, shared_ptr< Face > > m_transmittedDatas
App-level trace of transmitted Data.
Definition: ndn-app.hpp:122
ns3::ndn::App::m_transmittedNacks
TracedCallback< shared_ptr< const lp::Nack >, Ptr< App >, shared_ptr< Face > > m_transmittedNacks
App-level trace of transmitted Nacks.
Definition: ndn-app.hpp:125
ns3::ndn::App::m_receivedInterests
TracedCallback< shared_ptr< const Interest >, Ptr< App >, shared_ptr< Face > > m_receivedInterests
App-level trace of received Interests.
Definition: ndn-app.hpp:110
ns3::ndn::App::NackTraceCallback
void(* NackTraceCallback)(shared_ptr< const lp::Nack >, Ptr< App >, shared_ptr< Face >)
Definition: ndn-app.hpp:86
ns3::ndn::App::InterestTraceCallback
void(* InterestTraceCallback)(shared_ptr< const Interest >, Ptr< App >, shared_ptr< Face >)
Definition: ndn-app.hpp:84
ns3::ndn::App::DataTraceCallback
void(* DataTraceCallback)(shared_ptr< const Data >, Ptr< App >, shared_ptr< Face >)
Definition: ndn-app.hpp:85
ns3::ndn::App::StopApplication
virtual void StopApplication()
Called at time specified by Stop.
Definition: ndn-app.cpp:162
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-strategy-choice-helper.hpp:34