NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
status-dataset-context.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2013-2022 Regents of the University of California.
4
*
5
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
6
*
7
* ndn-cxx library is free software: you can redistribute it and/or modify it under the
8
* terms of the GNU Lesser General Public License as published by the Free Software
9
* Foundation, either version 3 of the License, or (at your option) any later version.
10
*
11
* ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
12
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
14
*
15
* You should have received copies of the GNU General Public License and GNU Lesser
16
* General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
17
* <http://www.gnu.org/licenses/>.
18
*
19
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
20
*/
21
22
#ifndef NDN_CXX_MGMT_STATUS_DATASET_CONTEXT_HPP
23
#define NDN_CXX_MGMT_STATUS_DATASET_CONTEXT_HPP
24
25
#include "
ndn-cxx/interest.hpp
"
26
#include "
ndn-cxx/mgmt/control-response.hpp
"
27
28
namespace
ndn
{
29
namespace
mgmt {
30
34
class
StatusDatasetContext
: noncopyable
35
{
36
public
:
40
const
Name
&
41
getPrefix
()
const
42
{
43
return
m_prefix;
44
}
45
59
StatusDatasetContext
&
60
setPrefix
(
const
Name
& prefix);
61
66
void
67
append
(span<const uint8_t> bytes);
68
73
void
74
end
();
75
85
void
86
reject
(
const
ControlResponse
& resp =
ControlResponse
().setCode(400));
87
88
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE
:
89
using
DataSender = std::function<void(const Name& dataName, const Block& content, bool isFinalBlock)>;
90
using
NackSender
= std::function<void(const ControlResponse&)>;
91
92
StatusDatasetContext
(
const
Interest
& interest, DataSender dataSender,
NackSender
nackSender);
93
94
private
:
95
friend
class
Dispatcher
;
96
97
const
Interest
& m_interest;
98
DataSender m_dataSender;
99
NackSender
m_nackSender;
100
Name
m_prefix;
101
std::vector<uint8_t> m_buffer;
102
uint64_t m_segmentNo = 0;
103
104
enum class
State {
105
INITIAL,
106
RESPONDED,
107
FINALIZED,
108
};
109
State m_state = State::INITIAL;
110
};
111
112
}
// namespace mgmt
113
}
// namespace ndn
114
115
#endif // NDN_CXX_MGMT_STATUS_DATASET_CONTEXT_HPP
ndn::mgmt::StatusDatasetContext::reject
void reject(const ControlResponse &resp=ControlResponse().setCode(400))
Rejects the request.
Definition:
status-dataset-context.cpp:99
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
ndn::mgmt::Dispatcher
represents a dispatcher on server side of NFD Management protocol
Definition:
dispatcher.hpp:130
ndn::Interest
Represents an Interest packet.
Definition:
interest.hpp:48
control-response.hpp
ndn::mgmt::StatusDatasetContext::NackSender
std::function< void(const ControlResponse &)> NackSender
Definition:
status-dataset-context.hpp:90
ndn::nfd::ControlResponse
mgmt::ControlResponse ControlResponse
Definition:
control-response.hpp:30
ndn::mgmt::StatusDatasetContext::end
void end()
Finalizes the response successfully after appending zero or more blocks.
Definition:
status-dataset-context.cpp:85
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE
#define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE
Definition:
common.hpp:48
interest.hpp
ndn::Name
Represents an absolute name.
Definition:
name.hpp:41
ndn::mgmt::StatusDatasetContext::append
void append(span< const uint8_t > bytes)
Appends a sequence of bytes to the response.
Definition:
status-dataset-context.cpp:63
ndn::mgmt::StatusDatasetContext::setPrefix
StatusDatasetContext & setPrefix(const Name &prefix)
Changes the prefix of the response Data packets.
Definition:
status-dataset-context.cpp:40
ndn::mgmt::ControlResponse
ControlCommand response.
Definition:
control-response.hpp:32
ndn::mgmt::StatusDatasetContext
Provides a context for generating the response to a StatusDataset request.
Definition:
status-dataset-context.hpp:34
ndn::mgmt::StatusDatasetContext::StatusDatasetContext
StatusDatasetContext(const Interest &interest, DataSender dataSender, NackSender nackSender)
Definition:
status-dataset-context.cpp:29
ndn::mgmt::StatusDatasetContext::getPrefix
const Name & getPrefix() const
Returns the prefix of Data packets, with version component but without segment component.
Definition:
status-dataset-context.hpp:41
ndnSIM
ndn-cxx
ndn-cxx
mgmt
status-dataset-context.hpp
Generated on Fri May 6 2022 12:34:12 for ndnSIM by
1.8.13