NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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-face.hpp"
25 
26 #include "ns3/application.h"
27 #include "ns3/ptr.h"
28 #include "ns3/callback.h"
29 #include "ns3/traced-callback.h"
30 
31 namespace ns3 {
32 
33 class Packet;
34 
35 namespace ndn {
36 
47 class App : public Application {
48 public:
49  static TypeId
50  GetTypeId();
51 
55  App();
56  virtual ~App();
57 
61  uint32_t
62  GetId() const;
63 
71  virtual void
72  OnInterest(shared_ptr<const Interest> interest);
73 
80  virtual void
81  OnData(shared_ptr<const Data> data);
82 
83 protected:
87  virtual void
88  DoDispose();
89 
90  // inherited from Application base class. Originally they were private
91  virtual void
93 
94  virtual void
95  StopApplication();
96 
97 protected:
98  bool m_active;
99  shared_ptr<Face>
102 
104  TracedCallback<shared_ptr<const Interest>, Ptr<App>, shared_ptr<Face>>
106 
107  TracedCallback<shared_ptr<const Data>, Ptr<App>, shared_ptr<Face>>
109 
110  TracedCallback<shared_ptr<const Interest>, Ptr<App>, shared_ptr<Face>>
112 
113  TracedCallback<shared_ptr<const Data>, Ptr<App>, shared_ptr<Face>>
115 };
116 
117 } // namespace ndn
118 } // namespace ns3
119 
120 #endif // NDN_APP_H
virtual void StopApplication()
Called at time specified by Stop.
Definition: ndn-app.cpp:121
virtual ~App()
Definition: ndn-app.cpp:63
virtual void StartApplication()
Called at time specified by Start.
Definition: ndn-app.cpp:103
TracedCallback< shared_ptr< const Interest >, Ptr< App >, shared_ptr< Face > > m_receivedInterests
communicates
Definition: ndn-app.hpp:105
static TypeId GetTypeId()
Definition: ndn-app.cpp:36
virtual void OnInterest(shared_ptr< const Interest > interest)
Method that will be called every time new Interest arrives.
Definition: ndn-app.cpp:88
virtual void DoDispose()
Do cleanup when application is destroyed.
Definition: ndn-app.cpp:68
TracedCallback< shared_ptr< const Interest >, Ptr< App >, shared_ptr< Face > > m_transmittedInterests
App-level trace of transmitted Interests.
Definition: ndn-app.hpp:111
shared_ptr< Face > m_face
and StopApplication)
Definition: ndn-app.hpp:101
TracedCallback< shared_ptr< const Data >, Ptr< App >, shared_ptr< Face > > m_transmittedDatas
App-level trace of transmitted Data.
Definition: ndn-app.hpp:114
Base class that all NDN applications should be derived from.
Definition: ndn-app.hpp:47
App()
Default constructor.
Definition: ndn-app.cpp:57
TracedCallback< shared_ptr< const Data >, Ptr< App >, shared_ptr< Face > > m_receivedDatas
App-level trace of received Data.
Definition: ndn-app.hpp:108
bool m_active
Flag to indicate that application is active (set by StartApplication.
Definition: ndn-app.hpp:98
virtual void OnData(shared_ptr< const Data > data)
Method that will be called every time new Data arrives.
Definition: ndn-app.cpp:95
uint32_t GetId() const
Get application ID (ID of applications face)
Definition: ndn-app.cpp:79