Provides a context for generating the response to a StatusDataset request. More...
#include <status-dataset-context.hpp>
Public Types | |
using | NackSender = std::function< void(const ControlResponse &)> |
Public Member Functions | |
const Name & | getPrefix () const |
Returns the prefix of Data packets, with version component but without segment component. More... | |
StatusDatasetContext & | setPrefix (const Name &prefix) |
Changes the prefix of the response Data packets. More... | |
void | append (span< const uint8_t > bytes) |
Appends a sequence of bytes to the response. More... | |
void | end () |
Finalizes the response successfully after appending zero or more blocks. More... | |
void | reject (const ControlResponse &resp=ControlResponse().setCode(400)) |
Rejects the request. More... | |
StatusDatasetContext (const Interest &interest, DataSender dataSender, NackSender nackSender) | |
Public Attributes | |
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE | __pad0__: using DataSender = std::function<void(const Name& dataName |
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE const Block & | content |
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE const Block bool | isFinalBlock |
Friends | |
class | Dispatcher |
Provides a context for generating the response to a StatusDataset request.
Definition at line 34 of file status-dataset-context.hpp.
using ndn::mgmt::StatusDatasetContext::NackSender = std::function<void(const ControlResponse&)> |
Definition at line 90 of file status-dataset-context.hpp.
ndn::mgmt::StatusDatasetContext::StatusDatasetContext | ( | const Interest & | interest, |
DataSender | dataSender, | ||
NackSender | nackSender | ||
) |
Definition at line 29 of file status-dataset-context.cpp.
References ndn::Interest::getName(), and setPrefix().
|
inline |
Returns the prefix of Data packets, with version component but without segment component.
Definition at line 41 of file status-dataset-context.hpp.
References append(), end(), NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE, reject(), and setPrefix().
StatusDatasetContext & ndn::mgmt::StatusDatasetContext::setPrefix | ( | const Name & | prefix | ) |
Changes the prefix of the response Data packets.
prefix | the prefix; it must start with the Interest Name, may contain a version component, but must not contain a segment component |
StatusDatasetHandler may change the prefix of Data packets with this method, before sending any response.
The version component is optional, and will be generated from the current timestamp if omitted.
std::invalid_argument | prefix does not satisfy the requirements |
std::logic_error | append(), end(), or reject() has already been invoked |
Definition at line 40 of file status-dataset-context.cpp.
References ndn::Name::appendVersion(), ndn::Name::at(), ndn::Interest::getName(), ndn::Name::isPrefixOf(), ndn::name::Component::isSegment(), ndn::name::Component::isVersion(), and NDN_THROW.
Referenced by getPrefix(), and StatusDatasetContext().
void ndn::mgmt::StatusDatasetContext::append | ( | span< const uint8_t > | bytes | ) |
Appends a sequence of bytes to the response.
Definition at line 63 of file status-dataset-context.cpp.
References ndn::tlv::Content, ndn::encoding::makeBinaryBlock(), ndn::mgmt::MAX_PAYLOAD_LENGTH, ns3::ndn::Name, and NDN_THROW.
Referenced by nfd::CsManager::CsManager(), nfd::RibManager::enableLocalFields(), nfd::FibManager::FibManager(), nfd::ForwarderStatusManager::ForwarderStatusManager(), getPrefix(), nfd::makeFaceStatus(), and nfd::matchFilter().
void ndn::mgmt::StatusDatasetContext::end | ( | ) |
Finalizes the response successfully after appending zero or more blocks.
std::logic_error | reject() has already been invoked |
Definition at line 85 of file status-dataset-context.cpp.
References ndn::tlv::Content, ndn::encoding::makeBinaryBlock(), ndn::mgmt::MAX_PAYLOAD_LENGTH, ns3::ndn::Name, and NDN_THROW.
Referenced by nfd::CsManager::CsManager(), nfd::RibManager::enableLocalFields(), nfd::FibManager::FibManager(), nfd::ForwarderStatusManager::ForwarderStatusManager(), getPrefix(), nfd::makeFaceStatus(), and nfd::matchFilter().
void ndn::mgmt::StatusDatasetContext::reject | ( | const ControlResponse & | resp = ControlResponse().setCode(400) | ) |
Rejects the request.
resp | Content of producer-generated NACK |
This should be invoked when the incoming Interest is malformed. A producer-generated NACK will be returned to the requester.
Definition at line 99 of file status-dataset-context.cpp.
References NDN_THROW.
Referenced by getPrefix(), and nfd::matchFilter().
|
friend |
Definition at line 95 of file status-dataset-context.hpp.
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE ndn::mgmt::StatusDatasetContext::__pad0__ |
Definition at line 89 of file status-dataset-context.hpp.
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE const Block& ndn::mgmt::StatusDatasetContext::content |
Definition at line 89 of file status-dataset-context.hpp.
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE const Block bool ndn::mgmt::StatusDatasetContext::isFinalBlock |
Definition at line 89 of file status-dataset-context.hpp.