NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
ndn-app-face.cpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
20
#include "
ndn-app-face.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.AppFace"
);
31
32
namespace
ns3
{
33
namespace
ndn
{
34
35
AppFace::AppFace
(Ptr<App> app)
36
:
LocalFace
(FaceUri(
"appFace://"
), FaceUri(
"appFace://"
))
37
, m_node(app->GetNode())
38
, m_app(app)
39
{
40
NS_LOG_FUNCTION(
this
<< app);
41
42
NS_ASSERT(m_app != 0);
43
}
44
45
AppFace::~AppFace
()
46
{
47
NS_LOG_FUNCTION_NOARGS();
48
}
49
50
void
51
AppFace::close
()
52
{
53
this->
fail
(
"Close connection"
);
54
}
55
56
void
57
AppFace::sendInterest
(
const
Interest
& interest)
58
{
59
NS_LOG_FUNCTION(
this
<< &interest);
60
61
this->
emitSignal
(
onSendInterest
, interest);
62
63
// to decouple callbacks
64
Simulator::ScheduleNow(&
App::OnInterest
, m_app, interest.shared_from_this());
65
}
66
67
void
68
AppFace::sendData
(
const
Data
& data)
69
{
70
NS_LOG_FUNCTION(
this
<< &data);
71
72
this->
emitSignal
(
onSendData
, data);
73
74
// to decouple callbacks
75
Simulator::ScheduleNow(&
App::OnData
, m_app, data.shared_from_this());
76
}
77
78
void
79
AppFace::onReceiveInterest
(
const
Interest
& interest)
80
{
81
this->
emitSignal
(
onReceiveInterest
, interest);
82
}
83
84
void
85
AppFace::onReceiveData
(
const
Data
& data)
86
{
87
this->
emitSignal
(
onReceiveData
, data);
88
}
89
90
}
// namespace ndn
91
}
// namespace ns3
ns3::ndn::AppFace::sendInterest
virtual void sendInterest(const Interest &interest)
Send Interest towards application.
Definition:
ndn-app-face.cpp:57
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
nfd::Face::onSendInterest
signal::Signal< Face, Interest > onSendInterest
fires when an Interest is sent out
Definition:
face.hpp:86
ns3::ndn::AppFace::onReceiveData
void onReceiveData(const Data &data)
Send Data towards NFD.
Definition:
ndn-app-face.cpp:85
nfd::Face::onSendData
signal::Signal< Face, Data > onSendData
fires when a Data is sent out
Definition:
face.hpp:89
ndn-app.hpp
emitSignal
#define emitSignal(...)
(implementation detail)
Definition:
signal-emit.hpp:76
ns3::ndn::App::OnInterest
virtual void OnInterest(shared_ptr< const Interest > interest)
Method that will be called every time new Interest arrives.
Definition:
ndn-app.cpp:105
nfd::Face::fail
void fail(const std::string &reason)
fail the face and raise onFail event if it's UP; otherwise do nothing
Definition:
face.cpp:87
ns3::ndn::AppFace::onReceiveInterest
void onReceiveInterest(const Interest &interest)
Send Interest towards NFD.
Definition:
ndn-app-face.cpp:79
ns3
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
content-store-impl.cpp:38
ns3::ndn::Data
ndn-app-face.hpp
ns3::ndn::AppFace::~AppFace
virtual ~AppFace()
Definition:
ndn-app-face.cpp:45
nfd::LocalFace
LocalFace
Definition:
tcp-face.cpp:31
ns3::ndn::Interest
ns3::ndn::AppFace::sendData
virtual void sendData(const Data &data)
Send Data towards application.
Definition:
ndn-app-face.cpp:68
ns3::ndn::AppFace::close
virtual void close()
Close the face.
Definition:
ndn-app-face.cpp:51
ns3::ndn::AppFace::AppFace
AppFace(Ptr< App > app)
Default constructor.
Definition:
ndn-app-face.cpp:35
ns3::ndn::App::OnData
virtual void OnData(shared_ptr< const Data > data)
Method that will be called every time new Data arrives.
Definition:
ndn-app.cpp:112
ndnSIM
model
ndn-app-face.cpp
Generated on Tue Feb 23 2016 22:18:43 for ndnSIM by
1.8.11