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-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  // @TODO add NACK
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  // @TODO add NACK
116 
117  TracedCallback<shared_ptr<const Interest>, Ptr<App>, shared_ptr<Face>>
119 
120  TracedCallback<shared_ptr<const Data>, Ptr<App>, shared_ptr<Face>>
122 
123  // @TODO add NACK
124 };
125 
126 } // namespace ndn
127 } // namespace ns3
128 
129 #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:154
Implementation of LinkService for ndnSIM application.
uint32_t m_appId
Definition: ndn-app.hpp:107
virtual ~App()
Definition: ndn-app.cpp:69
void(* InterestTraceCallback)(shared_ptr< const Interest >, Ptr< App >, shared_ptr< Face >)
Definition: ndn-app.hpp:84
virtual void DoInitialize()
Definition: ndn-app.cpp:74
virtual void StartApplication()
Called at time specified by Start.
Definition: ndn-app.cpp:130
TracedCallback< shared_ptr< const Interest >, Ptr< App >, shared_ptr< Face > > m_receivedInterests
App-level trace of received Interests.
Definition: ndn-app.hpp:110
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:106
virtual void OnNack(shared_ptr< const lp::Nack > nack)
Method that will be called every time new Nack arrives.
Definition: ndn-app.cpp:120
Copyright (c) 2011-2015 Regents of the University of California.
virtual void DoDispose()
Definition: ndn-app.cpp:89
TracedCallback< shared_ptr< const Interest >, Ptr< App >, shared_ptr< Face > > m_transmittedInterests
App-level trace of transmitted Interests.
Definition: ndn-app.hpp:118
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:121
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:62
uint32_t GetId() const
Get application ID (ID of applications face)
Definition: ndn-app.cpp:100
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:113