NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
ndn::mgmt::StatusDatasetContext Class Reference

Provides a context for generating the response to a StatusDataset request. More...

#include <status-dataset-context.hpp>

Inheritance diagram for ndn::mgmt::StatusDatasetContext:
Collaboration diagram for ndn::mgmt::StatusDatasetContext:

Public Types

using NackSender = std::function< void(const ControlResponse &)>
 

Public Member Functions

const NamegetPrefix () const
 Returns the prefix of Data packets, with version component but without segment component. More...
 
StatusDatasetContextsetPrefix (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 Blockcontent
 
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE const Block bool isFinalBlock
 

Friends

class Dispatcher
 

Detailed Description

Provides a context for generating the response to a StatusDataset request.

Definition at line 34 of file status-dataset-context.hpp.

Member Typedef Documentation

◆ NackSender

using ndn::mgmt::StatusDatasetContext::NackSender = std::function<void(const ControlResponse&)>

Definition at line 90 of file status-dataset-context.hpp.

Constructor & Destructor Documentation

◆ StatusDatasetContext()

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().

Member Function Documentation

◆ getPrefix()

const Name& ndn::mgmt::StatusDatasetContext::getPrefix ( ) const
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().

◆ setPrefix()

StatusDatasetContext & ndn::mgmt::StatusDatasetContext::setPrefix ( const Name prefix)

Changes the prefix of the response Data packets.

Parameters
prefixthe 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.

Exceptions
std::invalid_argumentprefix does not satisfy the requirements
std::logic_errorappend(), 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().

◆ append()

void ndn::mgmt::StatusDatasetContext::append ( span< const uint8_t >  bytes)

◆ end()

void ndn::mgmt::StatusDatasetContext::end ( )

◆ reject()

void ndn::mgmt::StatusDatasetContext::reject ( const ControlResponse resp = ControlResponse().setCode(400))

Rejects the request.

Parameters
respContent of producer-generated NACK

This should be invoked when the incoming Interest is malformed. A producer-generated NACK will be returned to the requester.

Exceptions
std::logic_errorappend() or end() has already been invoked

Definition at line 99 of file status-dataset-context.cpp.

References NDN_THROW.

Referenced by getPrefix(), and nfd::matchFilter().

Friends And Related Function Documentation

◆ Dispatcher

friend class Dispatcher
friend

Definition at line 95 of file status-dataset-context.hpp.

Member Data Documentation

◆ __pad0__

NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE ndn::mgmt::StatusDatasetContext::__pad0__

Definition at line 89 of file status-dataset-context.hpp.

◆ content

NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE const Block& ndn::mgmt::StatusDatasetContext::content

Definition at line 89 of file status-dataset-context.hpp.

◆ isFinalBlock

NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE const Block bool ndn::mgmt::StatusDatasetContext::isFinalBlock

Definition at line 89 of file status-dataset-context.hpp.


The documentation for this class was generated from the following files: