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
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
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->
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->
onSendData
(data);
73
74
// to decouple callbacks
75
Simulator::ScheduleNow(&
App::OnData
, m_app, data.shared_from_this());
76
}
77
78
}
// namespace ndn
79
}
// namespace ns3
ns3::ndn::AppFace::sendInterest
virtual void sendInterest(const Interest &interest)
Send Interest towards application.
Definition:
ndn-app-face.cpp:57
nfd::Face::onSendInterest
EventEmitter< Interest > onSendInterest
fires when an Interest is sent out
Definition:
face.hpp:87
ndn-app.hpp
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:88
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:116
nfd::Face::onSendData
EventEmitter< Data > onSendData
fires when a Data is sent out
Definition:
face.hpp:90
ns3::ndn::Data
ndn-app-face.hpp
ns3::ndn::AppFace::~AppFace
virtual ~AppFace()
Definition:
ndn-app-face.cpp:45
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:95
ndnSIM
model
ndn-app-face.cpp
Generated on Wed Feb 18 2015 16:31:16 for ndnSIM by
1.8.7