22 #include "ns3/assert.h" 23 #include "ns3/packet.h" 28 NS_LOG_COMPONENT_DEFINE(
"ndn.App");
38 static TypeId tid = TypeId(
"ns3::ndn::App")
40 .SetParent<Application>()
41 .AddConstructor<App>()
43 .AddTraceSource(
"ReceivedInterests",
"ReceivedInterests",
45 "ns3::ndn::App::InterestTraceCallback")
47 .AddTraceSource(
"ReceivedDatas",
"ReceivedDatas",
49 "ns3::ndn::App::DataTraceCallback")
51 .AddTraceSource(
"TransmittedInterests",
"TransmittedInterests",
53 "ns3::ndn::App::InterestTraceCallback")
55 .AddTraceSource(
"TransmittedDatas",
"TransmittedDatas",
57 "ns3::ndn::App::DataTraceCallback");
64 ,
m_appId(
std::numeric_limits<uint32_t>::max())
75 NS_LOG_FUNCTION_NOARGS();
78 for (uint32_t
id = 0;
id < GetNode()->GetNApplications(); ++id) {
79 if (GetNode()->GetApplication(
id) ==
this) {
84 Application::DoInitialize();
90 NS_LOG_FUNCTION_NOARGS();
95 Application::DoDispose();
107 NS_LOG_FUNCTION(
this << interest);
114 NS_LOG_FUNCTION(
this << data);
122 NS_LOG_FUNCTION_NOARGS();
127 NS_ASSERT_MSG(GetNode()->GetObject<L3Protocol>() != 0,
128 "Ndn stack should be installed on the node " << GetNode());
131 m_face = std::make_shared<AppFace>(
this);
140 NS_LOG_FUNCTION_NOARGS();
Copyright (c) 2011-2015 Regents of the University of California.
virtual void StopApplication()
Called at time specified by Stop.
ndn App
Copyright (c) 2011-2015 Regents of the University of California.
NS_OBJECT_ENSURE_REGISTERED(ContentStore)
virtual void DoInitialize()
virtual void StartApplication()
Called at time specified by Start.
shared_ptr< AppFace > m_face
automatically created application face through which application communicates
TracedCallback< shared_ptr< const Interest >, Ptr< App >, shared_ptr< Face > > m_receivedInterests
App-level trace of received Interests.
static TypeId GetTypeId()
virtual void OnInterest(shared_ptr< const Interest > interest)
Method that will be called every time new Interest arrives.
Copyright (c) 2011-2015 Regents of the University of California.
TracedCallback< shared_ptr< const Interest >, Ptr< App >, shared_ptr< Face > > m_transmittedInterests
App-level trace of transmitted Interests.
TracedCallback< shared_ptr< const Data >, Ptr< App >, shared_ptr< Face > > m_transmittedDatas
App-level trace of transmitted Data.
Implementation network-layer of NDN stack.
App()
Default constructor.
TracedCallback< shared_ptr< const Data >, Ptr< App >, shared_ptr< Face > > m_receivedDatas
App-level trace of received Data.
bool m_active
Flag to indicate that application is active (set by StartApplication and StopApplication) ...
virtual void OnData(shared_ptr< const Data > data)
Method that will be called every time new Data arrives.
uint32_t GetId() const
Get application ID (ID of applications face)