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
TracedCallback< shared_ptr< const lp::Nack >, Ptr< App >, shared_ptr< Face > > m_receivedNacks
App-level trace of received Nacks.
Definition: ndn-app.hpp:116
Copyright (c) 2011-2015 Regents of the University of California.
virtual void StopApplication()
Called at time specified by Stop.
Definition: ndn-app.cpp:162
Implementation of LinkService for ndnSIM application.
uint32_t m_appId
Definition: ndn-app.hpp:107
virtual ~App()
Definition: ndn-app.cpp:77
TracedCallback< shared_ptr< const lp::Nack >, Ptr< App >, shared_ptr< Face > > m_transmittedNacks
App-level trace of transmitted Nacks.
Definition: ndn-app.hpp:125
void(* InterestTraceCallback)(shared_ptr< const Interest >, Ptr< App >, shared_ptr< Face >)
Definition: ndn-app.hpp:84
virtual void DoInitialize()
Definition: ndn-app.cpp:82
virtual void StartApplication()
Called at time specified by Start.
Definition: ndn-app.cpp:138
TracedCallback< shared_ptr< const Interest >, Ptr< App >, shared_ptr< Face > > m_receivedInterests
App-level trace of received Interests.
Definition: ndn-app.hpp:110
void(* NackTraceCallback)(shared_ptr< const lp::Nack >, Ptr< App >, shared_ptr< Face >)
Definition: ndn-app.hpp:86
static TypeId GetTypeId()
Definition: ndn-app.cpp:37
virtual void OnInterest(shared_ptr< const Interest > interest)
Method that will be called every time new Interest arrives.
Definition: ndn-app.cpp:114
virtual void OnNack(shared_ptr< const lp::Nack > nack)
Method that will be called every time new Nack arrives.
Definition: ndn-app.cpp:128
Copyright (c) 2011-2015 Regents of the University of California.
virtual void DoDispose()
Definition: ndn-app.cpp:97
TracedCallback< shared_ptr< const Interest >, Ptr< App >, shared_ptr< Face > > m_transmittedInterests
App-level trace of transmitted Interests.
Definition: ndn-app.hpp:119
shared_ptr< Face > m_face
Definition: ndn-app.hpp:104
void(* DataTraceCallback)(shared_ptr< const Data >, Ptr< App >, shared_ptr< Face >)
Definition: ndn-app.hpp:85
TracedCallback< shared_ptr< const Data >, Ptr< App >, shared_ptr< Face > > m_transmittedDatas
App-level trace of transmitted Data.
Definition: ndn-app.hpp:122
AppLinkService * m_appLink
Definition: ndn-app.hpp:105
Base class that all NDN applications should be derived from.
Definition: ndn-app.hpp:48
App()
Default constructor.
Definition: ndn-app.cpp:70
uint32_t GetId() const
Get application ID (ID of applications face)
Definition: ndn-app.cpp:108
TracedCallback< shared_ptr< const Data >, Ptr< App >, shared_ptr< Face > > m_receivedDatas
App-level trace of received Data.
Definition: ndn-app.hpp:113
bool m_active
Flag to indicate that application is active (set by StartApplication and StopApplication)
Definition: ndn-app.hpp:103
virtual void OnData(shared_ptr< const Data > data)
Method that will be called every time new Data arrives.
Definition: ndn-app.cpp:121