NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
ndn::name::detail::Sha256ComponentType Class Referencefinal

Rules for a component type holding a SHA256 digest value, written as a hex string in URI representation. More...

#include <name-component-types.hpp>

Inheritance diagram for ndn::name::detail::Sha256ComponentType:
Collaboration diagram for ndn::name::detail::Sha256ComponentType:

Public Member Functions

 Sha256ComponentType (uint32_t type, const std::string &typeName, const std::string &uriPrefix)
 
bool match (const Component &comp) const
 
void check (const Component &comp) const final
 Throw Component::Error if comp is invalid. More...
 
Component create (ConstBufferPtr value) const
 
Component create (const uint8_t *value, size_t valueSize) const
 
std::pair< bool, ComponentgetSuccessor (const Component &comp) const final
 Calculate the successor of comp. More...
 
const std::vector< uint8_t > & getMinValue () const final
 Return the minimum allowable TLV-VALUE of this component type. More...
 
const char * getAltUriPrefix () const final
 Return the prefix of the alternate URI representation. More...
 
Component parseAltUriValue (const std::string &input) const final
 Parse component from alternate URI representation. More...
 
void writeUri (std::ostream &os, const Component &comp) const final
 Write URI representation of comp to os. More...
 
- Public Member Functions inherited from ndn::name::detail::ComponentType
virtual ~ComponentType ()=default
 

Additional Inherited Members

- Public Types inherited from ndn::name::detail::ComponentType
using Error = Component::Error
 
- Protected Member Functions inherited from ndn::name::detail::ComponentType
std::pair< bool, BlockgetSuccessorImpl (const Component &comp) const
 Calculate the successor of comp, extending TLV-LENGTH if value overflows. More...
 
void writeUriEscapedValue (std::ostream &os, const Component &comp) const
 Write TLV-VALUE as <escaped-value> of NDN URI syntax. More...
 

Detailed Description

Rules for a component type holding a SHA256 digest value, written as a hex string in URI representation.

Definition at line 172 of file name-component-types.hpp.

Constructor & Destructor Documentation

◆ Sha256ComponentType()

ndn::name::detail::Sha256ComponentType::Sha256ComponentType ( uint32_t  type,
const std::string &  typeName,
const std::string &  uriPrefix 
)
inline

Definition at line 175 of file name-component-types.hpp.

Member Function Documentation

◆ match()

bool ndn::name::detail::Sha256ComponentType::match ( const Component comp) const
inline

◆ check()

void ndn::name::detail::Sha256ComponentType::check ( const Component comp) const
inlinefinalvirtual

Throw Component::Error if comp is invalid.

Reimplemented from ndn::name::detail::ComponentType.

Definition at line 189 of file name-component-types.hpp.

References ndn::util::Sha256::DIGEST_SIZE, NDN_THROW, and ndn::to_string().

◆ create() [1/2]

Component ndn::name::detail::Sha256ComponentType::create ( ConstBufferPtr  value) const
inline

◆ create() [2/2]

Component ndn::name::detail::Sha256ComponentType::create ( const uint8_t *  value,
size_t  valueSize 
) const
inline

Definition at line 204 of file name-component-types.hpp.

References ndn::encoding::makeBinaryBlock().

◆ getSuccessor()

std::pair<bool, Component> ndn::name::detail::Sha256ComponentType::getSuccessor ( const Component comp) const
inlinefinalvirtual

Calculate the successor of comp.

If comp is the maximum possible value of this component type, return true to indicate that the successor should have a greater TLV-TYPE.

Reimplemented from ndn::name::detail::ComponentType.

Definition at line 210 of file name-component-types.hpp.

References ndn::name::detail::ComponentType::getSuccessorImpl().

◆ getMinValue()

const std::vector<uint8_t>& ndn::name::detail::Sha256ComponentType::getMinValue ( ) const
inlinefinalvirtual

Return the minimum allowable TLV-VALUE of this component type.

Reimplemented from ndn::name::detail::ComponentType.

Definition at line 222 of file name-component-types.hpp.

References ndn::util::Sha256::DIGEST_SIZE.

◆ getAltUriPrefix()

const char* ndn::name::detail::Sha256ComponentType::getAltUriPrefix ( ) const
inlinefinalvirtual

Return the prefix of the alternate URI representation.

NDN URI specification allows a name component type to declare an alternate URI representation in the form of <prefix>=<value>, in addition to the plain <type-number>=<escaped-value> syntax.

Returns
the <prefix> portion of the alternate URI representation.
Return values
nullptrthis component does not have an alternate URI representation.

Reimplemented from ndn::name::detail::ComponentType.

Definition at line 229 of file name-component-types.hpp.

◆ parseAltUriValue()

Component ndn::name::detail::Sha256ComponentType::parseAltUriValue ( const std::string &  ) const
inlinefinalvirtual

Parse component from alternate URI representation.

Parameters
inputthe <value> portion of the alternate URI representation.
Exceptions
Component::Error
Precondition
getAltUriPrefix() != nullptr

Reimplemented from ndn::name::detail::ComponentType.

Definition at line 235 of file name-component-types.hpp.

References ndn::fromHex(), nonstd::optional_lite::std11::move(), and NDN_THROW.

◆ writeUri()

void ndn::name::detail::Sha256ComponentType::writeUri ( std::ostream &  os,
const Component comp 
) const
inlinefinalvirtual

Write URI representation of comp to os.

This base class implementation encodes the component in the plain <type-number>=<escaped-value> syntax.

Reimplemented from ndn::name::detail::ComponentType.

Definition at line 248 of file name-component-types.hpp.

References ndn::printHex().


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