#include <status-dataset-context.hpp>
Public Member Functions | |
const Name & | getPrefix () const |
StatusDatasetContext & | setPrefix (const Name &prefix) |
change prefix of Data packets More... | |
const time::milliseconds & | getExpiry () const |
StatusDatasetContext & | setExpiry (const time::milliseconds &expiry) |
set expiration duration More... | |
void | append (const Block &block) |
append a Block to the response More... | |
void | end () |
end the response successfully after appending zero or more blocks More... | |
void | reject (const ControlResponse &resp=ControlResponse().setCode(400)) |
declare the non-existence of a response More... | |
StatusDatasetContext (const Interest &interest, const DataSender &dataSender) | |
Public Attributes | |
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE | __pad0__: typedef 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 const MetaInfo &metaInfo | DataSender |
Friends | |
class | Dispatcher |
Definition at line 38 of file status-dataset-context.hpp.
ndn::mgmt::StatusDatasetContext::StatusDatasetContext | ( | const Interest & | interest, |
const DataSender & | dataSender | ||
) |
Definition at line 126 of file status-dataset-context.cpp.
References ndn::Interest::getName(), and setPrefix().
const Name & ndn::mgmt::StatusDatasetContext::getPrefix | ( | ) | const |
Definition at line 34 of file status-dataset-context.cpp.
StatusDatasetContext & ndn::mgmt::StatusDatasetContext::setPrefix | ( | const Name & | prefix | ) |
change prefix of Data packets
prefix | the prefix; it must start with Interest Name, may contain version component, but must not contain segment component |
std::invalid_argument | prefix does not start with Interest Name |
std::domain_error | append, end, or reject has been invoked |
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 current timestamp when omitted.
Definition at line 40 of file status-dataset-context.cpp.
References ndn::Name::appendVersion(), ndn::Interest::getName(), and ndn::Name::isPrefixOf().
Referenced by StatusDatasetContext().
const time::milliseconds & ndn::mgmt::StatusDatasetContext::getExpiry | ( | ) | const |
Definition at line 60 of file status-dataset-context.cpp.
StatusDatasetContext & ndn::mgmt::StatusDatasetContext::setExpiry | ( | const time::milliseconds & | expiry | ) |
set expiration duration
The response will be cached for the specified duration. Incoming Interest that matches a cached response will be satisfied with that response, without invoking StatusDatasetHandler again.
Definition at line 66 of file status-dataset-context.cpp.
void ndn::mgmt::StatusDatasetContext::append | ( | const Block & | block | ) |
append a Block to the response
std::domain_error | end or reject has been invoked |
Definition at line 73 of file status-dataset-context.cpp.
References ndn::tlv::Content, content, ndn::encoding::makeBinaryBlock(), ndn::MAX_NDN_PACKET_SIZE, ndn::tlv::MetaInfo, ns3::ndn::Name, ndn::Block::size(), and ndn::Block::wire().
void ndn::mgmt::StatusDatasetContext::end | ( | ) |
end the response successfully after appending zero or more blocks
std::domain_error | reject has been invoked |
Definition at line 100 of file status-dataset-context.cpp.
References ndn::tlv::Content, ndn::encoding::makeBinaryBlock(), ndn::tlv::MetaInfo, and ns3::ndn::Name.
void ndn::mgmt::StatusDatasetContext::reject | ( | const ControlResponse & | resp = ControlResponse().setCode(400) | ) |
declare the non-existence of a response
std::domain_error | append or end has been invoked |
This should be invoked when the incoming Interest is malformed. A producer-generated NACK will be returned to requester.
content | Content of producer-generated NACK |
Definition at line 114 of file status-dataset-context.cpp.
References ndn::tlv::ContentType_Nack, ndn::Interest::getName(), ndn::tlv::MetaInfo, and ndn::mgmt::ControlResponse::wireEncode().
|
friend |
Definition at line 103 of file status-dataset-context.hpp.
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE ndn::mgmt::StatusDatasetContext::__pad0__ |
Definition at line 97 of file status-dataset-context.hpp.
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE const Block& ndn::mgmt::StatusDatasetContext::content |
Definition at line 97 of file status-dataset-context.hpp.
Referenced by append().
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE const Block const MetaInfo& metaInfo ndn::mgmt::StatusDatasetContext::DataSender |
Definition at line 97 of file status-dataset-context.hpp.