|
NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
|
API Documentation
|
Go to the documentation of this file.
22 #include "ns3/assert.h"
23 #include "ns3/packet.h"
29 NS_LOG_COMPONENT_DEFINE(
"ndn.App");
39 static TypeId tid = TypeId(
"ns3::ndn::App")
41 .SetParent<Application>()
42 .AddConstructor<App>()
44 .AddTraceSource(
"ReceivedInterests",
"ReceivedInterests",
46 "ns3::ndn::App::InterestTraceCallback")
48 .AddTraceSource(
"ReceivedDatas",
"ReceivedDatas",
50 "ns3::ndn::App::DataTraceCallback")
52 .AddTraceSource(
"ReceivedNacks",
"ReceivedNacks",
54 "ns3::ndn::App::NackTraceCallback")
56 .AddTraceSource(
"TransmittedInterests",
"TransmittedInterests",
58 "ns3::ndn::App::InterestTraceCallback")
60 .AddTraceSource(
"TransmittedDatas",
"TransmittedDatas",
62 "ns3::ndn::App::DataTraceCallback")
64 .AddTraceSource(
"TransmittedNacks",
"TransmittedNacks",
66 "ns3::ndn::App::NackTraceCallback");
73 , m_appId(std::numeric_limits<uint32_t>::max())
84 NS_LOG_FUNCTION_NOARGS();
87 for (uint32_t
id = 0;
id < GetNode()->GetNApplications(); ++id) {
88 if (GetNode()->GetApplication(
id) ==
this) {
93 Application::DoInitialize();
99 NS_LOG_FUNCTION_NOARGS();
104 Application::DoDispose();
116 NS_LOG_FUNCTION(
this << interest);
123 NS_LOG_FUNCTION(
this << data);
130 NS_LOG_FUNCTION(
this << nack);
140 NS_LOG_FUNCTION_NOARGS();
145 NS_ASSERT_MSG(GetNode()->GetObject<L3Protocol>() != 0,
146 "Ndn stack should be installed on the node " << GetNode());
149 auto appLink = make_unique<AppLinkService>(
this);
150 auto transport = make_unique<NullTransport>(
"appFace://",
"appFace://",
164 NS_LOG_FUNCTION_NOARGS();
Implementation of LinkService for ndnSIM application.
Copyright (c) 2011-2015 Regents of the University of California.
virtual void OnData(shared_ptr< const Data > data)
Method that will be called every time new Data arrives.
virtual void OnNack(shared_ptr< const lp::Nack > nack)
Method that will be called every time new Nack arrives.
bool m_active
Flag to indicate that application is active (set by StartApplication and StopApplication)
AppLinkService * m_appLink
NS_OBJECT_ENSURE_REGISTERED(GlobalRouter)
App()
Default constructor.
virtual void StartApplication()
Called at time specified by Start.
TracedCallback< shared_ptr< const Data >, Ptr< App >, shared_ptr< Face > > m_receivedDatas
App-level trace of received Data.
virtual void DoInitialize()
virtual void OnInterest(shared_ptr< const Interest > interest)
Method that will be called every time new Interest arrives.
TracedCallback< shared_ptr< const lp::Nack >, Ptr< App >, shared_ptr< Face > > m_receivedNacks
App-level trace of received Nacks.
static TypeId GetTypeId()
Base class that all NDN applications should be derived from.
uint32_t GetId() const
Get application ID (ID of applications face)
@ FACE_SCOPE_LOCAL
face is local
TracedCallback< shared_ptr< const Interest >, Ptr< App >, shared_ptr< Face > > m_transmittedInterests
App-level trace of transmitted Interests.
shared_ptr< Face > m_face
TracedCallback< shared_ptr< const Data >, Ptr< App >, shared_ptr< Face > > m_transmittedDatas
App-level trace of transmitted Data.
Implementation network-layer of NDN stack.
TracedCallback< shared_ptr< const lp::Nack >, Ptr< App >, shared_ptr< Face > > m_transmittedNacks
App-level trace of transmitted Nacks.
TracedCallback< shared_ptr< const Interest >, Ptr< App >, shared_ptr< Face > > m_receivedInterests
App-level trace of received Interests.
virtual void StopApplication()
Called at time specified by Stop.
Copyright (c) 2011-2015 Regents of the University of California.