NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
ndn-app-link-service.cpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
20 #include "ndn-app-link-service.hpp"
21 
22 #include "ns3/log.h"
23 #include "ns3/packet.h"
24 #include "ns3/node.h"
25 #include "ns3/assert.h"
26 #include "ns3/simulator.h"
27 
28 #include "apps/ndn-app.hpp"
29 
30 NS_LOG_COMPONENT_DEFINE("ndn.AppLinkService");
31 
32 namespace ns3 {
33 namespace ndn {
34 
36  : m_node(app->GetNode())
37  , m_app(app)
38 {
39  NS_LOG_FUNCTION(this << app);
40 
41  NS_ASSERT(m_app != 0);
42 }
43 
45 {
46  NS_LOG_FUNCTION_NOARGS();
47 }
48 
49 void
50 AppLinkService::doSendInterest(const Interest& interest)
51 {
52  NS_LOG_FUNCTION(this << &interest);
53 
54  // to decouple callbacks
55  Simulator::ScheduleNow(&App::OnInterest, m_app, interest.shared_from_this());
56 }
57 
58 void
59 AppLinkService::doSendData(const Data& data)
60 {
61  NS_LOG_FUNCTION(this << &data);
62 
63  // to decouple callbacks
64  Simulator::ScheduleNow(&App::OnData, m_app, data.shared_from_this());
65 }
66 
67 void
68 AppLinkService::doSendNack(const lp::Nack& nack)
69 {
70  NS_LOG_FUNCTION(this << &nack);
71 
72  // to decouple callbacks
73  // Simulator::ScheduleNow(&App::OnNack, m_app, nack.shared_from_this());
74 }
75 
76 //
77 
78 void
80 {
81  this->receiveInterest(interest);
82 }
83 
84 void
86 {
87  this->receiveData(data);
88 }
89 
90 void
92 {
93  this->receiveNack(nack);
94 }
95 
96 } // namespace ndn
97 } // namespace ns3
Copyright (c) 2011-2015 Regents of the University of California.
void onReceiveInterest(const Interest &interest)
void onReceiveData(const Data &data)
represents a Network Nack
Definition: nack.hpp:40
AppLinkService(Ptr< App > app)
Default constructor.
virtual void OnInterest(shared_ptr< const Interest > interest)
Method that will be called every time new Interest arrives.
Definition: ndn-app.cpp:106
void onReceiveNack(const lp::Nack &nack)
void receiveNack(const lp::Nack &nack)
delivers received Nack to forwarding
Copyright (c) 2011-2015 Regents of the University of California.
void receiveData(const Data &data)
delivers received Data to forwarding
virtual void OnData(shared_ptr< const Data > data)
Method that will be called every time new Data arrives.
Definition: ndn-app.cpp:113
void receiveInterest(const Interest &interest)
delivers received Interest to forwarding