NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: 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-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 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 
87 protected:
88  virtual void
89  DoInitialize();
90 
91  virtual void
92  DoDispose();
93 
94  // inherited from Application base class. Originally they were private
95  virtual void
97 
98  virtual void
99  StopApplication();
100 
101 protected:
102  bool m_active;
103  shared_ptr<AppFace> m_face;
104  uint32_t m_appId;
105 
106  TracedCallback<shared_ptr<const Interest>, Ptr<App>, shared_ptr<Face>>
108 
109  TracedCallback<shared_ptr<const Data>, Ptr<App>, shared_ptr<Face>>
111 
112  TracedCallback<shared_ptr<const Interest>, Ptr<App>, shared_ptr<Face>>
114 
115  TracedCallback<shared_ptr<const Data>, Ptr<App>, shared_ptr<Face>>
117 };
118 
119 } // namespace ndn
120 } // namespace ns3
121 
122 #endif // NDN_APP_H
Copyright (c) 2011-2015 Regents of the University of California.
virtual void StopApplication()
Called at time specified by Stop.
Definition: ndn-app.cpp:138
uint32_t m_appId
Definition: ndn-app.hpp:104
virtual ~App()
Definition: ndn-app.cpp:68
void(* InterestTraceCallback)(shared_ptr< const Interest >, Ptr< App >, shared_ptr< Face >)
Definition: ndn-app.hpp:84
virtual void DoInitialize()
Definition: ndn-app.cpp:73
virtual void StartApplication()
Called at time specified by Start.
Definition: ndn-app.cpp:120
shared_ptr< AppFace > m_face
automatically created application face through which application communicates
Definition: ndn-app.hpp:103
TracedCallback< shared_ptr< const Interest >, Ptr< App >, shared_ptr< Face > > m_receivedInterests
App-level trace of received Interests.
Definition: ndn-app.hpp:107
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:105
Copyright (c) 2011-2015 Regents of the University of California.
virtual void DoDispose()
Definition: ndn-app.cpp:88
TracedCallback< shared_ptr< const Interest >, Ptr< App >, shared_ptr< Face > > m_transmittedInterests
App-level trace of transmitted Interests.
Definition: ndn-app.hpp:113
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:116
Base class that all NDN applications should be derived from.
Definition: ndn-app.hpp:47
App()
Default constructor.
Definition: ndn-app.cpp:61
TracedCallback< shared_ptr< const Data >, Ptr< App >, shared_ptr< Face > > m_receivedDatas
App-level trace of received Data.
Definition: ndn-app.hpp:110
bool m_active
Flag to indicate that application is active (set by StartApplication and StopApplication) ...
Definition: ndn-app.hpp:102
virtual void OnData(shared_ptr< const Data > data)
Method that will be called every time new Data arrives.
Definition: ndn-app.cpp:112
uint32_t GetId() const
Get application ID (ID of applications face)
Definition: ndn-app.cpp:99