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
ndnlp-partial-message-store.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26
#ifndef NFD_DAEMON_FACE_NDNLP_PARTIAL_MESSAGE_STORE_HPP
27
#define NFD_DAEMON_FACE_NDNLP_PARTIAL_MESSAGE_STORE_HPP
28
29
#include "
ndnlp-data.hpp
"
30
#include "
core/scheduler.hpp
"
31
32
namespace
nfd
{
33
namespace
ndnlp {
34
37
class
PartialMessage
38
{
39
public
:
40
PartialMessage
();
41
42
PartialMessage
(
const
PartialMessage
&) =
delete
;
43
44
PartialMessage
&
45
operator=
(
const
PartialMessage
&) =
delete
;
46
47
PartialMessage
(
PartialMessage
&&) =
default
;
48
49
PartialMessage
&
50
operator=
(
PartialMessage
&&) =
default
;
51
52
bool
53
add
(uint16_t fragIndex, uint16_t fragCount,
const
Block
& payload);
54
55
bool
56
isComplete
()
const
;
57
62
std::tuple<bool, Block>
63
reassemble
();
64
69
static
std::tuple<bool, Block>
70
reassembleSingle
(
const
NdnlpData
& fragment);
71
72
public
:
73
scheduler::ScopedEventId
expiry
;
74
75
private
:
76
size_t
m_fragCount;
77
size_t
m_received;
78
std::vector<Block> m_payloads;
79
size_t
m_totalLength;
80
};
81
84
class
PartialMessageStore
: noncopyable
85
{
86
public
:
87
explicit
88
PartialMessageStore
(
const
time::nanoseconds& idleDuration = time::milliseconds(100));
89
94
void
95
receive(
const
NdnlpData
& pkt);
96
99
signal::Signal<PartialMessageStore, Block>
onReceive
;
100
101
private
:
102
void
103
scheduleCleanup(uint64_t messageIdentifier,
PartialMessage
& partialMessage);
104
105
void
106
cleanup(uint64_t messageIdentifier);
107
108
private
:
109
std::unordered_map<uint64_t, PartialMessage> m_partialMessages;
110
111
time::nanoseconds m_idleDuration;
112
};
113
114
}
// namespace ndnlp
115
}
// namespace nfd
116
117
#endif // NFD_DAEMON_FACE_NDNLP_PARTIAL_MESSAGE_STORE_HPP
nfd::ndnlp::PartialMessage::add
bool add(uint16_t fragIndex, uint16_t fragCount, const Block &payload)
Definition:
ndnlp-partial-message-store.cpp:42
nfd::ndnlp::PartialMessage::operator=
PartialMessage & operator=(const PartialMessage &)=delete
nfd::ndnlp::PartialMessage::reassembleSingle
static std::tuple< bool, Block > reassembleSingle(const NdnlpData &fragment)
reassemble network layer packet from a single fragment
Definition:
ndnlp-partial-message-store.cpp:85
nfd::ndnlp::NdnlpData
represents a NdnlpData packet
Definition:
ndnlp-data.hpp:43
ndnlp-data.hpp
nfd::ndnlp::PartialMessageStore::onReceive
signal::Signal< PartialMessageStore, Block > onReceive
fires when network layer packet is received
Definition:
ndnlp-partial-message-store.hpp:99
nfd::ndnlp::PartialMessage::isComplete
bool isComplete() const
Definition:
ndnlp-partial-message-store.cpp:64
ndn::Block
Class representing a wire element of NDN-TLV packet format.
Definition:
block.hpp:43
nfd::ndnlp::PartialMessage
represents a partially received message
Definition:
ndnlp-partial-message-store.hpp:37
ndn::util::signal::Signal
provides a lightweight signal / event system
Definition:
signal-signal.hpp:50
nfd::ndnlp::PartialMessage::expiry
scheduler::ScopedEventId expiry
Definition:
ndnlp-partial-message-store.hpp:73
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:38
nfd::scheduler::ScopedEventId
cancels an event automatically upon destruction
Definition:
scheduler.hpp:53
nfd::ndnlp::PartialMessage::reassemble
std::tuple< bool, Block > reassemble()
reassemble network layer packet
Definition:
ndnlp-partial-message-store.cpp:70
scheduler.hpp
nfd::ndnlp::PartialMessageStore
provides reassembly feature at receiver
Definition:
ndnlp-partial-message-store.hpp:84
nfd::ndnlp::PartialMessage::PartialMessage
PartialMessage()
Definition:
ndnlp-partial-message-store.cpp:34
ndnSIM
NFD
daemon
face
ndnlp-partial-message-store.hpp
Generated on Tue Feb 23 2016 22:18:44 for ndnSIM by
1.8.11