NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
lp-reassembler.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26
#ifndef NFD_DAEMON_FACE_LP_REASSEMBLER_HPP
27
#define NFD_DAEMON_FACE_LP_REASSEMBLER_HPP
28
29
#include "
core/scheduler.hpp
"
30
#include "
face-log.hpp
"
31
#include "
transport.hpp
"
32
33
#include <ndn-cxx/lp/packet.hpp>
34
35
namespace
nfd
{
36
namespace
face
{
37
38
class
LinkService
;
39
43
class
LpReassembler
: noncopyable
44
{
45
public
:
48
class
Options
49
{
50
public
:
51
Options
();
52
53
public
:
58
size_t
nMaxFragments
;
59
62
time::nanoseconds
reassemblyTimeout
;
63
};
64
65
explicit
66
LpReassembler
(
const
Options
& options =
Options
(),
const
LinkService
* linkService =
nullptr
);
67
70
void
71
setOptions
(
const
Options
& options);
72
77
const
LinkService
*
78
getLinkService
()
const
;
79
89
std::tuple<bool, Block, lp::Packet>
90
receiveFragment
(
Transport::EndpointId
remoteEndpoint,
const
lp::Packet
& packet);
91
94
size_t
95
size
()
const
;
96
104
signal::Signal<LpReassembler, Transport::EndpointId, size_t>
beforeTimeout
;
105
106
private
:
109
struct
PartialPacket
110
{
111
std::vector<lp::Packet> fragments;
112
size_t
fragCount;
113
size_t
nReceivedFragments;
114
scheduler::ScopedEventId
dropTimer;
115
};
116
119
typedef
std::tuple<
120
Transport::EndpointId
,
// remoteEndpoint
121
lp::Sequence
// message identifier (sequence of the first fragment)
122
> Key;
123
124
Block
125
doReassembly(
const
Key& key);
126
127
void
128
timeoutPartialPacket(
const
Key& key);
129
130
private
:
131
Options
m_options;
132
std::map<Key, PartialPacket> m_partialPackets;
133
const
LinkService
* m_linkService;
134
};
135
136
std::ostream&
137
operator<<(std::ostream& os, const FaceLogHelper<LpReassembler>& flh);
138
139
inline
void
140
LpReassembler::setOptions
(
const
Options
& options)
141
{
142
m_options = options;
143
}
144
145
inline
const
LinkService
*
146
LpReassembler::getLinkService
()
const
147
{
148
return
m_linkService;
149
}
150
151
inline
size_t
152
LpReassembler::size
()
const
153
{
154
return
m_partialPackets.size();
155
}
156
157
}
// namespace face
158
}
// namespace nfd
159
160
#endif // NFD_DAEMON_FACE_LP_REASSEMBLER_HPP
nfd::face::LpReassembler::beforeTimeout
signal::Signal< LpReassembler, Transport::EndpointId, size_t > beforeTimeout
signals before a partial packet is dropped due to timeout
Definition:
lp-reassembler.hpp:104
nfd::face::LinkService
the upper part of a Face
Definition:
link-service.hpp:73
nfd::face::LpReassembler::Options::nMaxFragments
size_t nMaxFragments
maximum number of fragments in a packet
Definition:
lp-reassembler.hpp:58
nfd::face::LinkService
LinkService
Definition:
link-service.cpp:32
face-log.hpp
nfd::face::LpReassembler::LpReassembler
LpReassembler(const Options &options=Options(), const LinkService *linkService=nullptr)
Definition:
lp-reassembler.cpp:41
ndn::Block
Class representing a wire element of NDN-TLV packet format.
Definition:
block.hpp:43
nfd::face::LpReassembler::Options::Options
Options()
Definition:
lp-reassembler.cpp:35
ndn::util::signal::Signal
provides a lightweight signal / event system
Definition:
signal-signal.hpp:50
ndn::lp::Sequence
uint64_t Sequence
represents a sequence number
Definition:
sequence.hpp:35
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:40
nfd::scheduler::ScopedEventId
cancels an event automatically upon destruction
Definition:
scheduler.hpp:57
face
nfd::face::LpReassembler
reassembles fragmented network-layer packets
Definition:
lp-reassembler.hpp:43
nfd::face::LpReassembler::setOptions
void setOptions(const Options &options)
set options for reassembler
Definition:
lp-reassembler.hpp:140
nfd::face::LpReassembler::Options
Options that control the behavior of LpReassembler.
Definition:
lp-reassembler.hpp:48
scheduler.hpp
transport.hpp
nfd::face::LpReassembler::Options::reassemblyTimeout
time::nanoseconds reassemblyTimeout
timeout before a partially reassembled packet is dropped
Definition:
lp-reassembler.hpp:62
nfd::face::LpReassembler::receiveFragment
std::tuple< bool, Block, lp::Packet > receiveFragment(Transport::EndpointId remoteEndpoint, const lp::Packet &packet)
adds received fragment to buffer
Definition:
lp-reassembler.cpp:48
nfd::face::LpReassembler::getLinkService
const LinkService * getLinkService() const
Definition:
lp-reassembler.hpp:146
nfd::face::Transport::EndpointId
uint64_t EndpointId
identifies an endpoint on the link
Definition:
transport.hpp:109
ndn::lp::Packet
Definition:
packet.hpp:30
nfd::face::LpReassembler::size
size_t size() const
count of partial packets
Definition:
lp-reassembler.hpp:152
ndnSIM
NFD
daemon
face
lp-reassembler.hpp
Generated on Sat Nov 12 2016 16:02:53 for ndnSIM by
1.8.12