Represents a name component. More...
#include <name-component.hpp>
Classes | |
class | Error |
Public Member Functions | |
Component (uint32_t type=tlv::GenericNameComponent) | |
Construct a NameComponent of TLV-TYPE type and with empty TLV-VALUE. More... | |
Component (const Block &block) | |
Construct a NameComponent from block . More... | |
Component (uint32_t type, ConstBufferPtr buffer) | |
Construct a NameComponent of TLV-TYPE type , using TLV-VALUE from buffer . More... | |
Component (ConstBufferPtr buffer) | |
Construct a GenericNameComponent, using TLV-VALUE from buffer . More... | |
Component (uint32_t type, span< const uint8_t > value) | |
Construct a NameComponent of TLV-TYPE type , copying the TLV-VALUE from value . More... | |
Component (span< const uint8_t > buffer) | |
Construct a GenericNameComponent, copying the TLV-VALUE from buffer . More... | |
Component (uint32_t type, const uint8_t *value, size_t count) | |
Construct a NameComponent of TLV-TYPE type , copying count bytes at value as TLV-VALUE. More... | |
Component (const uint8_t *value, size_t count) | |
Construct a GenericNameComponent, copying count bytes at value as TLV-VALUE. More... | |
template<class Iterator > | |
Component (uint32_t type, Iterator first, Iterator last) | |
Construct a NameComponent of TLV-TYPE type , copying TLV-VALUE from a range. More... | |
template<class Iterator > | |
Component (Iterator first, Iterator last) | |
Construct a GenericNameComponent, copying TLV-VALUE from a range. More... | |
Component (const char *str) | |
Construct a GenericNameComponent, copying TLV-VALUE from a null-terminated string. More... | |
Component (const std::string &str) | |
Construct a GenericNameComponent, copying TLV-VALUE from a string. More... | |
template<encoding::Tag TAG> | |
size_t | wireEncode (EncodingImpl< TAG > &encoder) const |
Fast encoding or block size estimation. More... | |
const Block & | wireEncode () const |
Encode to a wire format. More... | |
void | wireDecode (const Block &wire) |
Decode from the wire format. More... | |
void | toUri (std::ostream &os, UriFormat format=UriFormat::DEFAULT) const |
Write *this to the output stream, escaping characters according to the NDN URI format. More... | |
std::string | toUri (UriFormat format=UriFormat::DEFAULT) const |
Convert *this by escaping characters according to the NDN URI format. More... | |
bool | isNumber () const |
Check if the component is a NonNegativeInteger. More... | |
bool | isNumberWithMarker (uint8_t marker) const |
Check if the component is a NameComponentWithMarker per NDN naming conventions rev1. More... | |
bool | isSegment () const |
Check if the component is a segment number per NDN naming conventions. More... | |
bool | isByteOffset () const |
Check if the component is a byte offset per NDN naming conventions. More... | |
bool | isVersion () const |
Check if the component is a version per NDN naming conventions. More... | |
bool | isTimestamp () const |
Check if the component is a timestamp per NDN naming conventions. More... | |
bool | isSequenceNumber () const |
Check if the component is a sequence number per NDN naming conventions. More... | |
uint64_t | toNumber () const |
Interpret this name component as a NonNegativeInteger. More... | |
uint64_t | toNumberWithMarker (uint8_t marker) const |
Interpret this name component as a NameComponentWithMarker. More... | |
uint64_t | toSegment () const |
Interpret as segment number component using NDN naming conventions. More... | |
uint64_t | toByteOffset () const |
Interpret as byte offset component using NDN naming conventions. More... | |
uint64_t | toVersion () const |
Interpret as version component using NDN naming conventions. More... | |
time::system_clock::time_point | toTimestamp () const |
Interpret as timestamp component using NDN naming conventions. More... | |
uint64_t | toSequenceNumber () const |
Interpret as sequence number component using NDN naming conventions. More... | |
bool | isGeneric () const noexcept |
Check if the component is a GenericNameComponent. More... | |
bool | isImplicitSha256Digest () const |
Check if the component is an ImplicitSha256DigestComponent. More... | |
bool | isParametersSha256Digest () const |
Check if the component is a ParametersSha256DigestComponent. More... | |
bool | isKeyword () const noexcept |
Check if the component is a KeywordNameComponent. More... | |
NDN_CXX_NODISCARD bool | empty () const |
bool | equals (const Component &other) const |
Check if this is the same component as other. More... | |
int | compare (const Component &other) const |
Compare this to the other Component using NDN canonical ordering. More... | |
Component | getSuccessor () const |
Get the successor of this name component. More... | |
Public Member Functions inherited from ndn::Block | |
Block () | |
Create an invalid Block. More... | |
Block (const Block &) | |
Copy constructor. More... | |
Block & | operator= (const Block &) |
Copy assignment operator. More... | |
Block (Block &&) noexcept | |
Move constructor. More... | |
Block & | operator= (Block &&) noexcept |
Move assignment operator. More... | |
Block (span< const uint8_t > buffer) | |
Parse Block from a byte range. More... | |
Block (const EncodingBuffer &buffer) | |
Parse Block from an EncodingBuffer. More... | |
Block (const ConstBufferPtr &buffer) | |
Parse Block from a wire Buffer. More... | |
Block (ConstBufferPtr buffer, Buffer::const_iterator begin, Buffer::const_iterator end, bool verifyLength=true) | |
Parse Block within boundaries of a wire Buffer. More... | |
Block (const Block &block, Block::const_iterator begin, Block::const_iterator end, bool verifyLength=true) | |
Parse Block within boundaries of an existing Block, reusing underlying wire Buffer. More... | |
Block (ConstBufferPtr buffer, uint32_t type, Buffer::const_iterator begin, Buffer::const_iterator end, Buffer::const_iterator valueBegin, Buffer::const_iterator valueEnd) | |
Create a Block from a wire Buffer without parsing. More... | |
Block (uint32_t type) | |
Create a zero-length Block with the specified TLV-TYPE. More... | |
Block (uint32_t type, ConstBufferPtr value) | |
Create a Block with the specified TLV-TYPE and TLV-VALUE. More... | |
Block (uint32_t type, const Block &value) | |
Create a Block with the specified TLV-TYPE and TLV-VALUE. More... | |
bool | isValid () const noexcept |
Check if the Block is valid. More... | |
void | reset () noexcept |
Reset the Block to a default-constructed state. More... | |
void | resetWire () noexcept |
Reset wire buffer but keep TLV-TYPE and sub-elements (if any) More... | |
bool | hasWire () const noexcept |
Check if the Block contains a fully encoded wire representation. More... | |
const_iterator | begin () const |
Get begin iterator of encoded wire. More... | |
const_iterator | end () const |
Get end iterator of encoded wire. More... | |
const uint8_t * | data () const |
Return a raw pointer to the beginning of the encoded wire. More... | |
const uint8_t * | wire () const |
size_t | size () const |
Return the size of the encoded wire, i.e., of the whole TLV. More... | |
ConstBufferPtr | getBuffer () const |
Get underlying buffer. More... | |
uint32_t | type () const noexcept |
Return the TLV-TYPE of the Block. More... | |
bool | hasValue () const noexcept |
Check if the Block has a non-empty TLV-VALUE. More... | |
const_iterator | value_begin () const noexcept |
Get begin iterator of TLV-VALUE. More... | |
const_iterator | value_end () const noexcept |
Get end iterator of TLV-VALUE. More... | |
size_t | value_size () const noexcept |
Return the size of TLV-VALUE, i.e., the TLV-LENGTH. More... | |
span< const uint8_t > | value_bytes () const noexcept |
Return a read-only view of TLV-VALUE as a contiguous range of bytes. More... | |
const uint8_t * | value () const noexcept |
Return a raw pointer to the beginning of TLV-VALUE. More... | |
Block | blockFromValue () const |
Return a new Block constructed from the TLV-VALUE of this Block. More... | |
void | parse () const |
Parse TLV-VALUE into sub-elements. More... | |
void | encode () |
Encode sub-elements into TLV-VALUE. More... | |
const Block & | get (uint32_t type) const |
Return the first sub-element of the specified TLV-TYPE. More... | |
element_const_iterator | find (uint32_t type) const |
Find the first sub-element of the specified TLV-TYPE. More... | |
void | remove (uint32_t type) |
Remove all sub-elements of the specified TLV-TYPE. More... | |
element_iterator | erase (element_const_iterator position) |
Erase a sub-element. More... | |
element_iterator | erase (element_const_iterator first, element_const_iterator last) |
Erase a range of sub-elements. More... | |
void | push_back (const Block &element) |
Append a sub-element. More... | |
void | push_back (Block &&element) |
Append a sub-element. More... | |
element_iterator | insert (element_const_iterator pos, const Block &element) |
Insert a sub-element. More... | |
const element_container & | elements () const |
Get container of sub-elements. More... | |
element_const_iterator | elements_begin () const |
Equivalent to elements().begin() More... | |
element_const_iterator | elements_end () const |
Equivalent to elements().end() More... | |
size_t | elements_size () const |
Equivalent to elements().size() More... | |
operator boost::asio::const_buffer () const | |
Implicit conversion to boost::asio::const_buffer More... | |
Static Public Member Functions | |
static Component | fromEscapedString (const char *input, size_t beginOffset, size_t endOffset) |
Decode NameComponent from a URI component. More... | |
static Component | fromEscapedString (const char *input) |
Decode NameComponent from a URI component. More... | |
static Component | fromEscapedString (const std::string &input) |
Decode NameComponent from a URI component. More... | |
static Component | fromNumber (uint64_t number, uint32_t type=tlv::GenericNameComponent) |
Create a component encoded as NonNegativeInteger. More... | |
static Component | fromNumberWithMarker (uint8_t marker, uint64_t number) |
Create a component encoded as NameComponentWithMarker. More... | |
static Component | fromSegment (uint64_t segmentNo) |
Create a segment number component using NDN naming conventions. More... | |
static Component | fromByteOffset (uint64_t offset) |
Create a byte offset component using NDN naming conventions. More... | |
static Component | fromVersion (uint64_t version) |
Create a version component using NDN naming conventions. More... | |
static Component | fromTimestamp (const time::system_clock::time_point &timePoint) |
Create a timestamp component using NDN naming conventions. More... | |
static Component | fromSequenceNumber (uint64_t seqNo) |
Create a sequence number component using NDN naming conventions. More... | |
static Component | fromImplicitSha256Digest (ConstBufferPtr digest) |
Create ImplicitSha256DigestComponent component. More... | |
static Component | fromImplicitSha256Digest (span< const uint8_t > digest) |
Create ImplicitSha256DigestComponent component. More... | |
static Component | fromParametersSha256Digest (ConstBufferPtr digest) |
Create ParametersSha256DigestComponent component. More... | |
static Component | fromParametersSha256Digest (span< const uint8_t > digest) |
Create ParametersSha256DigestComponent component. More... | |
Static Public Member Functions inherited from ndn::Block | |
static NDN_CXX_NODISCARD std::tuple< bool, Block > | fromBuffer (ConstBufferPtr buffer, size_t offset=0) |
Try to parse Block from a wire buffer. More... | |
static NDN_CXX_NODISCARD std::tuple< bool, Block > | fromBuffer (span< const uint8_t > buffer) |
Try to parse Block from a byte range. More... | |
static Block | fromStream (std::istream &is) |
Parse Block from an input stream. More... | |
Friends | |
bool | operator== (const Component &lhs, const Component &rhs) |
bool | operator!= (const Component &lhs, const Component &rhs) |
bool | operator< (const Component &lhs, const Component &rhs) |
bool | operator<= (const Component &lhs, const Component &rhs) |
bool | operator> (const Component &lhs, const Component &rhs) |
bool | operator>= (const Component &lhs, const Component &rhs) |
std::ostream & | operator<< (std::ostream &os, const Component &component) |
Additional Inherited Members | |
Public Types inherited from ndn::Block | |
using | value_type = Buffer::value_type |
using | const_iterator = Buffer::const_iterator |
using | element_container = std::vector< Block > |
using | element_iterator = element_container::iterator |
using | element_const_iterator = element_container::const_iterator |
Protected Attributes inherited from ndn::Block | |
shared_ptr< const Buffer > | m_buffer |
Underlying buffer storing TLV-VALUE and possibly TLV-TYPE and TLV-LENGTH fields. More... | |
Buffer::const_iterator | m_begin |
Buffer::const_iterator | m_end |
Buffer::const_iterator | m_valueBegin |
Buffer::const_iterator | m_valueEnd |
uint32_t | m_type = tlv::Invalid |
TLV-TYPE. More... | |
size_t | m_size = 0 |
Total size including Type-Length-Value. More... | |
element_container | m_elements |
Contains the sub-elements. More... | |
Represents a name component.
The Component class provides a read-only view of a Block interpreted as a name component. Although it inherits mutation methods from the Block base class, they must not be used, because the enclosing Name would not be updated correctly.
A name component is considered invalid if its TLV-TYPE is outside the range [1, 65535]
, or, if it is an ImplicitSha256DigestComponent
or a ParametersSha256DigestComponent
, its TLV-LENGTH is not 32.
Definition at line 107 of file name-component.hpp.
|
explicit |
Construct a NameComponent of TLV-TYPE type
and with empty TLV-VALUE.
Error | the NameComponent is invalid. |
Definition at line 128 of file name-component.cpp.
Referenced by fromNumber(), fromNumberWithMarker(), ndn::name::parseUriEscapedValue(), and wireDecode().
|
explicit |
Construct a NameComponent from block
.
Error | the NameComponent is invalid. |
Definition at line 134 of file name-component.cpp.
ndn::name::Component::Component | ( | uint32_t | type, |
ConstBufferPtr | buffer | ||
) |
Construct a NameComponent of TLV-TYPE type
, using TLV-VALUE from buffer
.
Error | the NameComponent is invalid. |
This constructor does not copy the underlying buffer, but retains a pointer to it. Therefore, the caller must not change the underlying buffer.
Definition at line 140 of file name-component.cpp.
|
inlineexplicit |
Construct a GenericNameComponent, using TLV-VALUE from buffer
.
Error | the NameComponent is invalid. |
This constructor does not copy the underlying buffer, but retains a pointer to it. Therefore, the caller must not change the underlying buffer.
Definition at line 148 of file name-component.hpp.
ndn::name::Component::Component | ( | uint32_t | type, |
span< const uint8_t > | value | ||
) |
Construct a NameComponent of TLV-TYPE type
, copying the TLV-VALUE from value
.
Definition at line 146 of file name-component.cpp.
|
inlineexplicit |
Construct a GenericNameComponent, copying the TLV-VALUE from buffer
.
Definition at line 162 of file name-component.hpp.
|
inline |
Construct a NameComponent of TLV-TYPE type
, copying count
bytes at value
as TLV-VALUE.
Definition at line 173 of file name-component.hpp.
|
inline |
Construct a GenericNameComponent, copying count
bytes at value
as TLV-VALUE.
Definition at line 183 of file name-component.hpp.
|
inline |
Construct a NameComponent of TLV-TYPE type
, copying TLV-VALUE from a range.
Iterator | an InputIterator dereferencing to a one-octet value type. More efficient implementation is available when it is a RandomAccessIterator . |
type | the TLV-TYPE. |
first | beginning of the range. |
last | past-end of the range. |
Definition at line 197 of file name-component.hpp.
|
inline |
Construct a GenericNameComponent, copying TLV-VALUE from a range.
Definition at line 206 of file name-component.hpp.
|
explicit |
Construct a GenericNameComponent, copying TLV-VALUE from a null-terminated string.
Bytes from the string are copied as is, and not interpreted as URI component.
Definition at line 152 of file name-component.cpp.
|
explicit |
Construct a GenericNameComponent, copying TLV-VALUE from a string.
Bytes from the string are copied as is, and not interpreted as URI component.
Definition at line 157 of file name-component.cpp.
size_t ndn::name::Component::wireEncode | ( | EncodingImpl< TAG > & | encoder | ) | const |
Fast encoding or block size estimation.
Definition at line 515 of file name-component.cpp.
References ndn::name::NDN_CXX_DEFINE_WIRE_ENCODE_INSTANTIATIONS(), ndn::Block::type(), ndn::Block::value_bytes(), and ndn::Block::value_size().
const Block & ndn::name::Component::wireEncode | ( | ) | const |
Encode to a wire format.
Definition at line 529 of file name-component.cpp.
References ndn::Block::hasWire(), and wireDecode().
void ndn::name::Component::wireDecode | ( | const Block & | wire | ) |
Decode from the wire format.
Definition at line 545 of file name-component.cpp.
References Component().
Referenced by wireEncode().
|
inlinestatic |
Decode NameComponent from a URI component.
The URI component is read from [input+beginOffset, input+endOffset)
range.
Error | URI component does not represent a valid NameComponent. |
Definition at line 255 of file name-component.hpp.
Referenced by ndn::Name::Name().
|
inlinestatic |
Decode NameComponent from a URI component.
Error | URI component does not represent a valid NameComponent. |
Definition at line 265 of file name-component.hpp.
References ndn::name::DEFAULT, ndn::tlv::GenericNameComponent, and websocketpp::http::parser::state::version.
|
static |
Decode NameComponent from a URI component.
Error | URI component does not represent a valid NameComponent. |
Definition at line 178 of file name-component.cpp.
References ndn::Block::find(), ndn::tlv::GenericNameComponent, ndn::tlv::NameComponentMax, ndn::tlv::NameComponentMin, NDN_THROW, ndn::name::parseUriEscapedValue(), ndn::to_string(), and ndn::Block::type().
void ndn::name::Component::toUri | ( | std::ostream & | os, |
UriFormat | format = UriFormat::DEFAULT |
||
) | const |
Write *this to the output stream, escaping characters according to the NDN URI format.
Definition at line 202 of file name-component.cpp.
References ndn::Block::type(), and ndn::name::wantAltUri().
Referenced by ndn::net::computePrefixLength(), ndn::RegexComponentMatcher::match(), and toUri().
std::string ndn::name::Component::toUri | ( | UriFormat | format = UriFormat::DEFAULT | ) | const |
Convert *this by escaping characters according to the NDN URI format.
Definition at line 213 of file name-component.cpp.
References toUri().
bool ndn::name::Component::isNumber | ( | ) | const |
Check if the component is a NonNegativeInteger.
Definition at line 223 of file name-component.cpp.
References ndn::Block::value_size().
Referenced by isByteOffset(), isSegment(), isSequenceNumber(), isTimestamp(), isVersion(), and toNumber().
bool ndn::name::Component::isNumberWithMarker | ( | uint8_t | marker | ) | const |
Check if the component is a NameComponentWithMarker per NDN naming conventions rev1.
Definition at line 230 of file name-component.cpp.
References ndn::Block::value(), and ndn::Block::value_size().
Referenced by isByteOffset(), isSegment(), isSequenceNumber(), isTimestamp(), isVersion(), and toNumberWithMarker().
bool ndn::name::Component::isSegment | ( | ) | const |
Check if the component is a segment number per NDN naming conventions.
Definition at line 237 of file name-component.cpp.
References ndn::name::canDecodeMarkerConvention(), ndn::name::canDecodeTypedConvention(), ndn::tlv::GenericNameComponent, isNumber(), isNumberWithMarker(), ndn::name::SEGMENT_MARKER, ndn::tlv::SegmentNameComponent, and ndn::Block::type().
Referenced by ndn::security::v2::CertificateBundleFetcher::doFetch(), ndn::mgmt::StatusDatasetContext::setPrefix(), and ndn::util::SegmentFetcher::stop().
bool ndn::name::Component::isByteOffset | ( | ) | const |
Check if the component is a byte offset per NDN naming conventions.
Definition at line 244 of file name-component.cpp.
References ndn::tlv::ByteOffsetNameComponent, ndn::name::canDecodeMarkerConvention(), ndn::name::canDecodeTypedConvention(), ndn::tlv::GenericNameComponent, isNumber(), isNumberWithMarker(), ndn::name::SEGMENT_OFFSET_MARKER, and ndn::Block::type().
bool ndn::name::Component::isVersion | ( | ) | const |
Check if the component is a version per NDN naming conventions.
Definition at line 251 of file name-component.cpp.
References ndn::name::canDecodeMarkerConvention(), ndn::name::canDecodeTypedConvention(), ndn::tlv::GenericNameComponent, isNumber(), isNumberWithMarker(), ndn::Block::type(), ndn::name::VERSION_MARKER, and ndn::tlv::VersionNameComponent.
Referenced by nfd::fw::Strategy::makeInstanceName(), and ndn::mgmt::StatusDatasetContext::setPrefix().
bool ndn::name::Component::isTimestamp | ( | ) | const |
Check if the component is a timestamp per NDN naming conventions.
Definition at line 258 of file name-component.cpp.
References ndn::name::canDecodeMarkerConvention(), ndn::name::canDecodeTypedConvention(), ndn::tlv::GenericNameComponent, isNumber(), isNumberWithMarker(), ndn::name::TIMESTAMP_MARKER, ndn::tlv::TimestampNameComponent, and ndn::Block::type().
bool ndn::name::Component::isSequenceNumber | ( | ) | const |
Check if the component is a sequence number per NDN naming conventions.
Definition at line 265 of file name-component.cpp.
References ndn::name::canDecodeMarkerConvention(), ndn::name::canDecodeTypedConvention(), ndn::tlv::GenericNameComponent, isNumber(), isNumberWithMarker(), ndn::name::SEQUENCE_NUMBER_MARKER, ndn::tlv::SequenceNumNameComponent, and ndn::Block::type().
uint64_t ndn::name::Component::toNumber | ( | ) | const |
Interpret this name component as a NonNegativeInteger.
Definition at line 274 of file name-component.cpp.
References isNumber(), NDN_THROW, and ndn::encoding::readNonNegativeInteger().
Referenced by toByteOffset(), toSegment(), toSequenceNumber(), toTimestamp(), and toVersion().
uint64_t ndn::name::Component::toNumberWithMarker | ( | uint8_t | marker | ) | const |
Interpret this name component as a NameComponentWithMarker.
marker | 1-byte octet of the marker |
Error | if name component does not have the specified marker. |
tlv::Error | if format does not follow NameComponentWithMarker specification. |
Definition at line 283 of file name-component.cpp.
References isNumberWithMarker(), NDN_THROW, ndn::tlv::readNonNegativeInteger(), ndn::Block::value_begin(), ndn::Block::value_end(), and ndn::Block::value_size().
Referenced by toByteOffset(), toSegment(), toSequenceNumber(), toTimestamp(), and toVersion().
uint64_t ndn::name::Component::toSegment | ( | ) | const |
Interpret as segment number component using NDN naming conventions.
tlv::Error | not a Segment component interpreted by the chosen convention(s). |
Definition at line 294 of file name-component.cpp.
References ndn::name::canDecodeMarkerConvention(), ndn::name::canDecodeTypedConvention(), ndn::tlv::GenericNameComponent, NDN_THROW, ndn::name::SEGMENT_MARKER, ndn::tlv::SegmentNameComponent, toNumber(), toNumberWithMarker(), and ndn::Block::type().
Referenced by ndn::util::SegmentFetcher::stop().
uint64_t ndn::name::Component::toByteOffset | ( | ) | const |
Interpret as byte offset component using NDN naming conventions.
tlv::Error | not a ByteOffset component interpreted by the chosen convention(s). |
Definition at line 306 of file name-component.cpp.
References ndn::tlv::ByteOffsetNameComponent, ndn::name::canDecodeMarkerConvention(), ndn::name::canDecodeTypedConvention(), ndn::tlv::GenericNameComponent, NDN_THROW, ndn::name::SEGMENT_OFFSET_MARKER, toNumber(), toNumberWithMarker(), and ndn::Block::type().
uint64_t ndn::name::Component::toVersion | ( | ) | const |
Interpret as version component using NDN naming conventions.
tlv::Error | not a Version component interpreted by the chosen convention(s). |
Definition at line 318 of file name-component.cpp.
References ndn::name::canDecodeMarkerConvention(), ndn::name::canDecodeTypedConvention(), ndn::tlv::GenericNameComponent, NDN_THROW, toNumber(), toNumberWithMarker(), ndn::Block::type(), ndn::name::VERSION_MARKER, and ndn::tlv::VersionNameComponent.
time::system_clock::time_point ndn::name::Component::toTimestamp | ( | ) | const |
Interpret as timestamp component using NDN naming conventions.
tlv::Error | not a Timestamp component interpreted by the chosen convention(s). |
Definition at line 330 of file name-component.cpp.
References ndn::name::canDecodeMarkerConvention(), ndn::name::canDecodeTypedConvention(), ndn::tlv::GenericNameComponent, ndn::time::getUnixEpoch(), NDN_THROW, ndn::name::TIMESTAMP_MARKER, ndn::tlv::TimestampNameComponent, toNumber(), toNumberWithMarker(), ndn::Block::type(), and ndn::Block::value().
uint64_t ndn::name::Component::toSequenceNumber | ( | ) | const |
Interpret as sequence number component using NDN naming conventions.
tlv::Error | not a SequenceNumber component interpreted by the chosen convention(s). |
Definition at line 346 of file name-component.cpp.
References ndn::name::canDecodeMarkerConvention(), ndn::name::canDecodeTypedConvention(), ndn::tlv::GenericNameComponent, NDN_THROW, ndn::name::SEQUENCE_NUMBER_MARKER, ndn::tlv::SequenceNumNameComponent, toNumber(), toNumberWithMarker(), and ndn::Block::type().
Referenced by ndn::util::NotificationSubscriberBase::stop().
|
static |
Create a component encoded as NonNegativeInteger.
number | The non-negative number |
type | TLV-TYPE |
Definition at line 360 of file name-component.cpp.
References Component(), and ndn::encoding::makeNonNegativeIntegerBlock().
Referenced by ndn::Name::appendNumber(), ndn::security::tpm::BackEnd::constructAsymmetricKeyName(), fromByteOffset(), fromSegment(), fromSequenceNumber(), fromTimestamp(), fromVersion(), and ndn::security::InterestSigner::makeCommandInterest().
|
static |
Create a component encoded as NameComponentWithMarker.
NameComponentWithMarker is defined as:
NameComponentWithMarker ::= NAME-COMPONENT-TYPE TLV-LENGTH Marker includedNonNegativeInteger Marker ::= BYTE includedNonNegativeInteger ::= BYTE{1,2,4,8}
marker | 1-byte marker octet |
number | The non-negative number |
Definition at line 366 of file name-component.cpp.
References Component(), ndn::tlv::GenericNameComponent, and ndn::encoding::Estimator::prependNonNegativeInteger().
Referenced by ndn::Name::appendNumberWithMarker(), fromByteOffset(), fromSegment(), fromSequenceNumber(), fromTimestamp(), and fromVersion().
|
static |
Create a segment number component using NDN naming conventions.
Definition at line 385 of file name-component.cpp.
References fromNumber(), fromNumberWithMarker(), ndn::name::MARKER, ndn::name::SEGMENT_MARKER, and ndn::tlv::SegmentNameComponent.
Referenced by ndn::Name::appendSegment(), and ndn::security::v2::CertificateBundleFetcher::doFetch().
|
static |
Create a byte offset component using NDN naming conventions.
Definition at line 393 of file name-component.cpp.
References ndn::tlv::ByteOffsetNameComponent, fromNumber(), fromNumberWithMarker(), ndn::name::MARKER, and ndn::name::SEGMENT_OFFSET_MARKER.
Referenced by ndn::Name::appendByteOffset().
|
static |
Create a version component using NDN naming conventions.
Definition at line 401 of file name-component.cpp.
References fromNumber(), fromNumberWithMarker(), ndn::name::MARKER, ndn::name::VERSION_MARKER, and ndn::tlv::VersionNameComponent.
Referenced by ndn::Name::appendVersion().
|
static |
Create a timestamp component using NDN naming conventions.
Definition at line 409 of file name-component.cpp.
References fromNumber(), fromNumberWithMarker(), ndn::time::getUnixEpoch(), ndn::name::MARKER, ndn::name::TIMESTAMP_MARKER, ndn::tlv::TimestampNameComponent, and ndn::Block::value().
Referenced by ndn::Name::appendTimestamp().
|
static |
Create a sequence number component using NDN naming conventions.
Definition at line 418 of file name-component.cpp.
References fromNumber(), fromNumberWithMarker(), ndn::name::MARKER, ndn::name::SEQUENCE_NUMBER_MARKER, and ndn::tlv::SequenceNumNameComponent.
Referenced by ndn::Name::appendSequenceNumber().
|
inlinenoexcept |
Check if the component is a GenericNameComponent.
Definition at line 476 of file name-component.hpp.
References ndn::tlv::GenericNameComponent.
bool ndn::name::Component::isImplicitSha256Digest | ( | ) | const |
Check if the component is an ImplicitSha256DigestComponent.
Definition at line 428 of file name-component.cpp.
References ndn::util::Sha256::DIGEST_SIZE, ndn::tlv::ImplicitSha256DigestComponent, ndn::Block::type(), and ndn::Block::value_size().
Referenced by ndn::security::v2::CertificateBundleFetcher::doFetch(), and ndn::Interest::matchesData().
|
static |
Create ImplicitSha256DigestComponent component.
Definition at line 434 of file name-component.cpp.
References ndn::tlv::ImplicitSha256DigestComponent, and nonstd::optional_lite::std11::move().
|
static |
Create ImplicitSha256DigestComponent component.
Definition at line 440 of file name-component.cpp.
References ndn::tlv::ImplicitSha256DigestComponent.
bool ndn::name::Component::isParametersSha256Digest | ( | ) | const |
Check if the component is a ParametersSha256DigestComponent.
Definition at line 446 of file name-component.cpp.
References ndn::util::Sha256::DIGEST_SIZE, ndn::tlv::ParametersSha256DigestComponent, ndn::Block::type(), and ndn::Block::value_size().
|
static |
Create ParametersSha256DigestComponent component.
Definition at line 452 of file name-component.cpp.
References nonstd::optional_lite::std11::move(), and ndn::tlv::ParametersSha256DigestComponent.
|
static |
Create ParametersSha256DigestComponent component.
Definition at line 458 of file name-component.cpp.
References ndn::tlv::ParametersSha256DigestComponent.
|
inlinenoexcept |
Check if the component is a KeywordNameComponent.
Definition at line 534 of file name-component.hpp.
References ndn::tlv::KeywordNameComponent, and NDN_CXX_NODISCARD.
|
inline |
Definition at line 541 of file name-component.hpp.
Referenced by compare(), and ndn::KeyParams::KeyParams().
bool ndn::name::Component::equals | ( | const Component & | other | ) | const |
Check if this is the same component as other.
other | The other Component to compare with |
Definition at line 466 of file name-component.cpp.
References ndn::Block::type(), ndn::Block::value_begin(), ndn::Block::value_end(), and ndn::Block::value_size().
int ndn::name::Component::compare | ( | const Component & | other | ) | const |
Compare this to the other Component using NDN canonical ordering.
other | The other Component to compare with. |
negative | this comes before other in canonical ordering |
zero | this equals other |
positive | this comes after other in canonical ordering |
Definition at line 474 of file name-component.cpp.
References ndn::Block::data(), empty(), ndn::Block::hasWire(), ndn::Block::size(), ndn::Block::type(), ndn::Block::value(), and ndn::Block::value_size().
Component ndn::name::Component::getSuccessor | ( | ) | const |
Get the successor of this name component.
The successor of a name component is defined as follows:
C represents the set of name components, and X,Y ∈ C. Operator < is defined by canonical order on C. Y is the successor of X, if (a) X < Y, and (b) ∄ Z ∈ C s.t. X < Z < Y.
In plain words, successor of a name component is the next possible name component.
Examples:
sha256digest=0000000000000000000000000000000000000000000000000000000000000000
is sha256digest=0000000000000000000000000000000000000000000000000000000000000001
.sha256digest=ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
is params-sha256=0000000000000000000000000000000000000000000000000000000000000000
.params-sha256=0000000000000000000000000000000000000000000000000000000000000000
is params-sha256=0000000000000000000000000000000000000000000000000000000000000001
.params-sha256=ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
is 3=...
....
is %00
.A
is B
.FF
is %00%00
. Definition at line 499 of file name-component.cpp.
References ndn::Block::get(), ndn::Block::type(), and ndn::Block::value().
Referenced by ndn::security::v2::CertificateBundleFetcher::doFetch().
Definition at line 608 of file name-component.hpp.
Definition at line 614 of file name-component.hpp.
Definition at line 620 of file name-component.hpp.
Definition at line 626 of file name-component.hpp.
Definition at line 632 of file name-component.hpp.
Definition at line 638 of file name-component.hpp.
|
friend |
Definition at line 644 of file name-component.hpp.