NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
link-service.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26
#ifndef NFD_DAEMON_FACE_LINK_SERVICE_HPP
27
#define NFD_DAEMON_FACE_LINK_SERVICE_HPP
28
29
#include "
core/counter.hpp
"
30
#include "
transport.hpp
"
31
#include "
face-log.hpp
"
32
33
namespace
nfd
{
34
namespace
face
{
35
36
class
Face
;
37
42
class
LinkServiceCounters
43
{
44
public
:
47
PacketCounter
nInInterests
;
48
51
PacketCounter
nOutInterests
;
52
55
PacketCounter
nInData
;
56
59
PacketCounter
nOutData
;
60
63
PacketCounter
nInNacks
;
64
67
PacketCounter
nOutNacks
;
68
};
69
73
class
LinkService
:
protected
virtual
LinkServiceCounters
, noncopyable
74
{
75
public
:
78
typedef
LinkServiceCounters
Counters
;
79
80
public
:
81
LinkService
();
82
83
virtual
84
~
LinkService
();
85
89
void
90
setFaceAndTransport(
Face
&
face
,
Transport
& transport);
91
94
const
Face
*
95
getFace()
const
;
96
99
const
Transport
*
100
getTransport()
const
;
101
104
Transport
*
105
getTransport();
106
107
virtual
const
Counters&
108
getCounters()
const
;
109
110
public
:
// upper interface to be used by forwarding
114
void
115
sendInterest(
const
Interest
& interest);
116
120
void
121
sendData(
const
Data
& data);
122
126
void
127
sendNack(
const
ndn::lp::Nack
& nack);
128
131
signal::Signal<LinkService, Interest>
afterReceiveInterest
;
132
135
signal::Signal<LinkService, Data>
afterReceiveData
;
136
139
signal::Signal<LinkService, lp::Nack>
afterReceiveNack
;
140
143
signal::Signal<LinkService, Interest>
afterSendInterest
;
144
147
signal::Signal<LinkService, Data>
afterSendData
;
148
151
signal::Signal<LinkService, lp::Nack>
afterSendNack
;
152
153
public
:
// lower interface to be invoked by Transport
156
void
157
receivePacket(
Transport::Packet
&& packet);
158
159
protected
:
// upper interface to be invoked in subclass (receive path termination)
162
void
163
receiveInterest(
const
Interest
& interest);
164
167
void
168
receiveData(
const
Data
& data);
169
172
void
173
receiveNack(
const
lp::Nack
& nack);
174
175
protected
:
// lower interface to be invoked in subclass (send path termination)
178
void
179
sendPacket(
Transport::Packet
&& packet);
180
181
private
:
// upper interface to be overridden in subclass (send path entrypoint)
184
virtual
void
185
doSendInterest(
const
Interest
& interest) = 0;
186
189
virtual
void
190
doSendData(
const
Data
& data) = 0;
191
194
virtual
void
195
doSendNack(
const
lp::Nack
& nack) = 0;
196
197
private
:
// lower interface to be overridden in subclass
198
virtual
void
199
doReceivePacket(
Transport::Packet
&& packet) = 0;
200
201
private
:
202
Face
* m_face;
203
Transport
* m_transport;
204
};
205
206
inline
const
Face
*
207
LinkService::getFace
()
const
208
{
209
return
m_face;
210
}
211
212
inline
const
Transport
*
213
LinkService::getTransport
()
const
214
{
215
return
m_transport;
216
}
217
218
inline
Transport
*
219
LinkService::getTransport
()
220
{
221
return
m_transport;
222
}
223
224
inline
const
LinkService::Counters
&
225
LinkService::getCounters
()
const
226
{
227
return
*
this
;
228
}
229
230
inline
void
231
LinkService::receivePacket
(
Transport::Packet
&& packet)
232
{
233
doReceivePacket(std::move(packet));
234
}
235
236
inline
void
237
LinkService::sendPacket
(
Transport::Packet
&& packet)
238
{
239
m_transport->send(std::move(packet));
240
}
241
242
std::ostream&
243
operator<<(std::ostream& os, const FaceLogHelper<LinkService>& flh);
244
245
template
<
typename
T>
246
typename
std::enable_if<std::is_base_of<LinkService, T>::value
&&
247
!
std::is_same<LinkService, T>::value
, std::ostream&>::type
248
operator<<(std::ostream& os, const FaceLogHelper<T>& flh)
249
{
250
return
os << FaceLogHelper<LinkService>(flh.obj);
251
}
252
253
}
// namespace face
254
}
// namespace nfd
255
256
#endif // NFD_DAEMON_FACE_LINK_SERVICE_HPP
nfd::face::LinkService::afterReceiveData
signal::Signal< LinkService, Data > afterReceiveData
signals on Data received
Definition:
link-service.hpp:135
nfd::face::LinkService::getFace
const Face * getFace() const
Definition:
link-service.hpp:207
nfd::face::LinkService
the upper part of a Face
Definition:
link-service.hpp:73
nfd::face::LinkServiceCounters::nOutData
PacketCounter nOutData
count of outgoing Data
Definition:
link-service.hpp:59
nfd::face::LinkServiceCounters::nInInterests
PacketCounter nInInterests
count of incoming Interests
Definition:
link-service.hpp:47
nfd::face::Face
generalization of a network interface
Definition:
face.hpp:67
nfd::face::LinkService
LinkService
Definition:
link-service.cpp:32
face-log.hpp
nfd::face::Transport::Packet
stores a packet along with the remote endpoint
Definition:
transport.hpp:113
nfd::face::LinkServiceCounters::nInNacks
PacketCounter nInNacks
count of incoming Nacks
Definition:
link-service.hpp:63
ndn::Interest
represents an Interest packet
Definition:
interest.hpp:42
nfd::PacketCounter
represents a counter of number of packets
Definition:
counter.hpp:77
nfd::face::LinkService::sendPacket
void sendPacket(Transport::Packet &&packet)
sends a lower-layer packet via Transport
Definition:
link-service.hpp:237
ndn::util::signal::Signal
provides a lightweight signal / event system
Definition:
signal.hpp:50
ndn::lp::Nack
represents a Network Nack
Definition:
nack.hpp:40
Face
ndn Face
Definition:
face-impl.hpp:41
counter.hpp
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:40
nfd::face::LinkService::afterReceiveNack
signal::Signal< LinkService, lp::Nack > afterReceiveNack
signals on Nack received
Definition:
link-service.hpp:139
nfd::face::LinkService::getCounters
virtual const Counters & getCounters() const
Definition:
link-service.hpp:225
nfd::face::LinkService::receivePacket
void receivePacket(Transport::Packet &&packet)
performs LinkService specific operations to receive a lower-layer packet
Definition:
link-service.hpp:231
nfd::face::LinkService::getTransport
const Transport * getTransport() const
Definition:
link-service.hpp:213
nfd::face::LinkServiceCounters
counters provided by LinkService
Definition:
link-service.hpp:42
face
nfd::face::LinkServiceCounters::nOutInterests
PacketCounter nOutInterests
count of outgoing Interests
Definition:
link-service.hpp:51
nfd::face::LinkService::Counters
LinkServiceCounters Counters
counters provided by LinkService
Definition:
link-service.hpp:78
nfd::face::LinkService::afterSendInterest
signal::Signal< LinkService, Interest > afterSendInterest
signals on Interest sent
Definition:
link-service.hpp:143
transport.hpp
nfd::face::LinkServiceCounters::nInData
PacketCounter nInData
count of incoming Data
Definition:
link-service.hpp:55
nfd::face::LinkServiceCounters::nOutNacks
PacketCounter nOutNacks
count of outgoing Nacks
Definition:
link-service.hpp:67
ndn::Data
Represents a Data packet.
Definition:
data.hpp:35
websocketpp::session::state::value
value
Definition:
connection.hpp:179
nfd::face::Transport
the lower part of a Face
Definition:
transport.hpp:104
nfd::face::LinkService::afterSendNack
signal::Signal< LinkService, lp::Nack > afterSendNack
signals on Nack sent
Definition:
link-service.hpp:151
nfd::face::LinkService::afterSendData
signal::Signal< LinkService, Data > afterSendData
signals on Data sent
Definition:
link-service.hpp:147
nfd::face::LinkService::afterReceiveInterest
signal::Signal< LinkService, Interest > afterReceiveInterest
signals on Interest received
Definition:
link-service.hpp:131
ndnSIM
NFD
daemon
face
link-service.hpp
Generated on Thu Nov 2 2017 03:30:29 for ndnSIM by
1.8.11