NS-3 based Named Data Networking (NDN) simulator
ndnSIM: NDN, CCN, CCNx, content centric networks
API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
callback-based-app.h
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2 /*
3  * Copyright (c) 2013, Regents of the University of California
4  * Alexander Afanasyev
5  * Zhenkai Zhu
6  *
7  * GNU v3.0 license, See the LICENSE file for more information
8  *
9  * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
10  */
11 
12 #ifndef NDN_CALLBACK_BASED_APP_H
13 #define NDN_CALLBACK_BASED_APP_H
14 
15 #include "ns3/application.h"
16 #include "ns3/ptr.h"
17 #include "ns3/callback.h"
18 
19 namespace ns3 {
20 
25 class CallbackBasedApp: public Application
26 {
27 public:
28  static TypeId GetTypeId ();
29 
34 
38  virtual
40 
44  void
45  SetOnStartCallback (Callback< void, Ptr<Application> > onStart);
46 
50  void
51  SetOnStopCallback (Callback< void, Ptr<Application> > onStart);
52 
53 protected:
54  // inherited from Application base class. Originally they were private
55  virtual void
56  StartApplication ();
57 
58  virtual void
59  StopApplication ();
60 
61 private:
62  Callback< void, Ptr<Application> > m_onStart;
63  Callback< void, Ptr<Application> > m_onStop;
64 };
65 
66 } // ns3
67 
68 #endif // NDN_CALLBACK_BASED_APP_H
virtual void StartApplication()
Called at time specified by Start.
CallbackBasedApp()
Default constructor.
void SetOnStopCallback(Callback< void, Ptr< Application > > onStart)
Define callback that will be fired when application need to stop its work.
virtual ~CallbackBasedApp()
Virtual destructor.
virtual void StopApplication()
Called at time specified by Stop.
void SetOnStartCallback(Callback< void, Ptr< Application > > onStart)
Define callback that will be fired when application need to start its work.
A meta application that can be used to create custom apps within Python bindings. ...