A NameLite::Component holds a pointer to the component value. More...
#include <name-lite.hpp>
Public Member Functions | |
| Component () | |
| Create a GENERIC NameLite::Component of zero size. | |
| Component (const uint8_t *value, size_t valueLength, ndn_NameComponentType type=ndn_NameComponentType_GENERIC, int otherTypeCode=-1) | |
| Create a NameLite::Component with the given value. More... | |
| Component (const BlobLite &value, ndn_NameComponentType type=ndn_NameComponentType_GENERIC, int otherTypeCode=-1) | |
| Create a NameLite::Component taking the pointer and size from the BlobLite value. More... | |
| const BlobLite & | getValue () const |
| Get the component value. More... | |
| ndn_NameComponentType | getType () const |
| Get the name component type. More... | |
| int | getOtherTypeCode () const |
| Get the component type code from the packet which is other than a recognized ndn_NameComponentType enum value. More... | |
| bool | isSegment () const |
| Check if this component is a segment number according to NDN naming conventions for "Segment number" (marker 0x00) and return an integer. More... | |
| bool | isSegmentOffset () const |
| Check if this component is a segment byte offset according to NDN naming conventions for "Byte offset" (marker 0xFB) and return an integer. More... | |
| bool | isVersion () const |
| Check if this component is a version number according to NDN naming conventions for "Versioning" (marker 0xFD) and return an integer. More... | |
| bool | isTimestamp () const |
| Check if this component is a timestamp according to NDN naming conventions for "Timestamp" (marker 0xFC) and return an integer. More... | |
| bool | isSequenceNumber () const |
| Check if this component is a sequence number according to NDN naming conventions for "Sequencing" (marker 0xFE) and return an integer. More... | |
| bool | isGeneric () const |
| Check if this component is a generic component. More... | |
| bool | isImplicitSha256Digest () const |
| Check if this component is an ImplicitSha256Digest component. More... | |
| bool | isParametersSha256Digest () const |
| Check if this component is a ParametersSha256Digest component. More... | |
| uint64_t | toNumber () const |
| Interpret the name component as a network-ordered number and return an integer. More... | |
| ndn_Error | toNumberWithMarker (uint8_t marker, uint64_t &result) const |
| Interpret the name component as a network-ordered number with a marker and return an integer. More... | |
| ndn_Error | toNumberWithPrefix (const uint8_t *prefix, size_t prefixLength, uint64_t &result) const |
| Interpret the name component as a network-ordered number with a prefix and return an integer. More... | |
| bool | hasPrefix (const uint8_t *prefix, size_t prefixLength) const |
| Check if this name component begins with the given prefix. More... | |
| ndn_Error | toSegment (uint64_t &result) const |
| Interpret this name component as a segment number according to NDN naming conventions for "Segment number" (marker 0x00). More... | |
| ndn_Error | toSegmentOffset (uint64_t &result) const |
| Interpret this name component as a segment byte offset according to NDN naming conventions for segment "Byte offset" (marker 0xFB). More... | |
| ndn_Error | toVersion (uint64_t &result) const |
| Interpret this name component as a version number according to NDN naming conventions for "Versioning" (marker 0xFD). More... | |
| ndn_Error | toTimestamp (uint64_t &result) const |
| Interpret this name component as a timestamp according to NDN naming conventions for "Timestamp" (marker 0xFC). More... | |
| ndn_Error | toSequenceNumber (uint64_t &result) const |
| Interpret this name component as a sequence number according to NDN naming conventions for "Sequencing" (marker 0xFE). More... | |
| bool | equals (const Component &other) const |
| Check if this is the same component as other. More... | |
| int | compare (const Component &other) const |
| Compare this component to the other component using NDN component ordering. More... | |
| ndn_Error | setFromNumber (uint64_t number, uint8_t *buffer, size_t bufferLength, ndn_NameComponentType type=ndn_NameComponentType_GENERIC, int otherTypeCode=-1) |
| Set this name component to have a value which is the nonNegativeInteger encoding of the number. More... | |
| ndn_Error | setFromNumberWithMarker (uint64_t number, uint8_t marker, uint8_t *buffer, size_t bufferLength) |
| Set this name component to have a value which is the marker appended with the nonNegativeInteger encoding of the number. More... | |
| ndn_Error | setSegment (uint64_t segment, uint8_t *buffer, size_t bufferLength) |
| Set this name component to have the encoded segment number according to NDN naming conventions for "Segment number" (marker 0x00). More... | |
| ndn_Error | setSegmentOffset (uint64_t segmentOffset, uint8_t *buffer, size_t bufferLength) |
| Set this name component to have the encoded segment byte offset according to NDN naming conventions for segment "Byte offset" (marker 0xFB). More... | |
| ndn_Error | setVersion (uint64_t version, uint8_t *buffer, size_t bufferLength) |
| Set this name component to have the encoded version number according to NDN naming conventions for "Versioning" (marker 0xFD). More... | |
| ndn_Error | setTimestamp (uint64_t timestamp, uint8_t *buffer, size_t bufferLength) |
| Set this name component to have the encoded timestamp according to NDN naming conventions for "Timestamp" (marker 0xFC). More... | |
| ndn_Error | setSequenceNumber (uint64_t sequenceNumber, uint8_t *buffer, size_t bufferLength) |
| Set this name component to have the encoded sequence number according to NDN naming conventions for "Sequencing" (marker 0xFE). More... | |
| ndn_Error | setImplicitSha256Digest (const uint8_t *digest, size_t digestLength) |
| Set this name component to have type ImplicitSha256DigestComponent with the given digest value, so that isImplicitSha256Digest() is true. More... | |
| ndn_Error | setImplicitSha256Digest (const BlobLite &digest) |
| Set this name component to have type ImplicitSha256DigestComponent with the given digest value, so that isImplicitSha256Digest() is true. More... | |
| ndn_Error | setParametersSha256Digest (const uint8_t *digest, size_t digestLength) |
| Set this name component to have type ParametersSha256DigestComponent with the given digest value, so that isParametersSha256Digest() is true. More... | |
| ndn_Error | setParametersSha256Digest (const BlobLite &digest) |
| Set this name component to have type ParametersSha256DigestComponent with the given digest value, so that isParametersSha256Digest() is true. More... | |
Static Public Member Functions | |
| static Component & | downCast (ndn_NameComponent &component) |
| Downcast the reference to the ndn_NameComponent struct to a NameLite::Component. More... | |
| static const Component & | downCast (const ndn_NameComponent &component) |
Friends | |
| class | NameLite |
| class | ExcludeLite |
A NameLite::Component holds a pointer to the component value.
| ndn::NameLite::Component::Component | ( | const uint8_t * | value, |
| size_t | valueLength, | ||
| ndn_NameComponentType | type = ndn_NameComponentType_GENERIC, |
||
| int | otherTypeCode = -1 |
||
| ) |
Create a NameLite::Component with the given value.
| value | The pre-allocated buffer for the value. |
| valueLength | The number of bytes in value. |
| type | (optional) The component type as an int from the ndn_NameComponentType enum. If the name component type is not a recognized ndn_NameComponentType enum value, then set this to ndn_NameComponentType_OTHER_CODE and use the otherTypeCode parameter. If omitted, use ndn_NameComponentType_GENERIC. |
| otherTypeCode | (optional) If type is ndn_NameComponentType_OTHER_CODE, then this is the packet's unrecognized content type code, which must be non-negative. |
| ndn::NameLite::Component::Component | ( | const BlobLite & | value, |
| ndn_NameComponentType | type = ndn_NameComponentType_GENERIC, |
||
| int | otherTypeCode = -1 |
||
| ) |
Create a NameLite::Component taking the pointer and size from the BlobLite value.
| value | The BlobLite with the pointer to use for this component. |
| type | (optional) The component type as an int from the ndn_NameComponentType enum. If the name component type is not a recognized ndn_NameComponentType enum value, then set this to ndn_NameComponentType_OTHER_CODE and use the otherTypeCode parameter. If omitted, use ndn_NameComponentType_GENERIC. |
| otherTypeCode | (optional) If type is ndn_NameComponentType_OTHER_CODE, then this is the packet's unrecognized content type code, which must be non-negative. |
| int ndn::NameLite::Component::compare | ( | const Component & | other | ) | const |
Compare this component to the other component using NDN component ordering.
A component is less if it is shorter, otherwise if equal length do a byte comparison.
| other | The other name component to compare with. |
|
inlinestatic |
Downcast the reference to the ndn_NameComponent struct to a NameLite::Component.
| component | A reference to the ndn_NameComponent struct. |
| bool ndn::NameLite::Component::equals | ( | const Component & | other | ) | const |
Check if this is the same component as other.
| other | The other name component to check. |
|
inline |
Get the component type code from the packet which is other than a recognized ndn_NameComponentType enum value.
This is only meaningful if getType() is ndn_NameComponentType_OTHER_CODE.
|
inline |
Get the name component type.
|
inline |
Get the component value.
| bool ndn::NameLite::Component::hasPrefix | ( | const uint8_t * | prefix, |
| size_t | prefixLength | ||
| ) | const |
Check if this name component begins with the given prefix.
| prefix | The required prefix of the component. |
| prefixLength | The length of prefix. |
| bool ndn::NameLite::Component::isGeneric | ( | ) | const |
Check if this component is a generic component.
| bool ndn::NameLite::Component::isImplicitSha256Digest | ( | ) | const |
Check if this component is an ImplicitSha256Digest component.
| bool ndn::NameLite::Component::isParametersSha256Digest | ( | ) | const |
Check if this component is a ParametersSha256Digest component.
| bool ndn::NameLite::Component::isSegment | ( | ) | const |
Check if this component is a segment number according to NDN naming conventions for "Segment number" (marker 0x00) and return an integer.
http://named-data.net/doc/tech-memos/naming-conventions.pdf
| bool ndn::NameLite::Component::isSegmentOffset | ( | ) | const |
Check if this component is a segment byte offset according to NDN naming conventions for "Byte offset" (marker 0xFB) and return an integer.
http://named-data.net/doc/tech-memos/naming-conventions.pdf
| bool ndn::NameLite::Component::isSequenceNumber | ( | ) | const |
Check if this component is a sequence number according to NDN naming conventions for "Sequencing" (marker 0xFE) and return an integer.
http://named-data.net/doc/tech-memos/naming-conventions.pdf
| bool ndn::NameLite::Component::isTimestamp | ( | ) | const |
Check if this component is a timestamp according to NDN naming conventions for "Timestamp" (marker 0xFC) and return an integer.
http://named-data.net/doc/tech-memos/naming-conventions.pdf
| bool ndn::NameLite::Component::isVersion | ( | ) | const |
Check if this component is a version number according to NDN naming conventions for "Versioning" (marker 0xFD) and return an integer.
http://named-data.net/doc/tech-memos/naming-conventions.pdf
| ndn_Error ndn::NameLite::Component::setFromNumber | ( | uint64_t | number, |
| uint8_t * | buffer, | ||
| size_t | bufferLength, | ||
| ndn_NameComponentType | type = ndn_NameComponentType_GENERIC, |
||
| int | otherTypeCode = -1 |
||
| ) |
Set this name component to have a value which is the nonNegativeInteger encoding of the number.
Also set the type to ndn_NameComponentType_GENERIC.
| number | The number to be encoded. |
| buffer | The allocated buffer to hold the name component value. This buffer must remain valid during the life of the name component. It is the caller's responsibility to free this buffer if necessary when finished with it. |
| bufferLength | The number of bytes in the allocated buffer. This should be at least 8 bytes to hold a 64-bit value. |
| type | (optional) The component type as an int from the ndn_NameComponentType enum. If the name component type is not a recognized ndn_NameComponentType enum value, then set this to ndn_NameComponentType_OTHER_CODE and use the otherTypeCode parameter. If omitted, use ndn_NameComponentType_GENERIC. |
| otherTypeCode | (optional) If type is ndn_NameComponentType_OTHER_CODE, then this is the packet's unrecognized content type code, which must be non-negative. |
| ndn_Error ndn::NameLite::Component::setFromNumberWithMarker | ( | uint64_t | number, |
| uint8_t | marker, | ||
| uint8_t * | buffer, | ||
| size_t | bufferLength | ||
| ) |
Set this name component to have a value which is the marker appended with the nonNegativeInteger encoding of the number.
Also set the type to ndn_NameComponentType_GENERIC.
| number | The number to be encoded. |
| marker | The marker to use as the first byte of the component. |
| buffer | The allocated buffer to hold the name component value. This buffer must remain valid during the life of the name component. It is the caller's responsibility to free this buffer if necessary when finished with it. |
| bufferLength | The number of bytes in the allocated buffer. This should be at least 9 bytes to hold a marker plus a 64-bit value. |
| ndn_Error ndn::NameLite::Component::setImplicitSha256Digest | ( | const uint8_t * | digest, |
| size_t | digestLength | ||
| ) |
Set this name component to have type ImplicitSha256DigestComponent with the given digest value, so that isImplicitSha256Digest() is true.
| digest | The pre-allocated buffer for the SHA-256 digest value. |
| digestLength | The length of digest, which must be ndn_SHA256_DIGEST_SIZE. |
|
inline |
Set this name component to have type ImplicitSha256DigestComponent with the given digest value, so that isImplicitSha256Digest() is true.
| digest | The BlobLite with the pre-allocated buffer for the SHA-256 digest value. Its size must be ndn_SHA256_DIGEST_SIZE. |
| ndn_Error ndn::NameLite::Component::setParametersSha256Digest | ( | const uint8_t * | digest, |
| size_t | digestLength | ||
| ) |
Set this name component to have type ParametersSha256DigestComponent with the given digest value, so that isParametersSha256Digest() is true.
| digest | The pre-allocated buffer for the SHA-256 digest value. |
| digestLength | The length of digest, which must be ndn_SHA256_DIGEST_SIZE. |
|
inline |
Set this name component to have type ParametersSha256DigestComponent with the given digest value, so that isParametersSha256Digest() is true.
| digest | The pre-allocated buffer for the SHA-256 digest value. |
| digestLength | The length of digest, which must be ndn_SHA256_DIGEST_SIZE. |
| ndn_Error ndn::NameLite::Component::setSegment | ( | uint64_t | segment, |
| uint8_t * | buffer, | ||
| size_t | bufferLength | ||
| ) |
Set this name component to have the encoded segment number according to NDN naming conventions for "Segment number" (marker 0x00).
http://named-data.net/doc/tech-memos/naming-conventions.pdf
| segment | The segment number. |
| buffer | The allocated buffer to hold the name component value. This buffer must remain valid during the life of the name component. It is the caller's responsibility to free this buffer if necessary when finished with it. |
| bufferLength | The number of bytes in the allocated buffer. This should be at least 9 bytes to hold a marker plus a 64-bit value. |
| ndn_Error ndn::NameLite::Component::setSegmentOffset | ( | uint64_t | segmentOffset, |
| uint8_t * | buffer, | ||
| size_t | bufferLength | ||
| ) |
Set this name component to have the encoded segment byte offset according to NDN naming conventions for segment "Byte offset" (marker 0xFB).
http://named-data.net/doc/tech-memos/naming-conventions.pdf
| segmentOffset | The segment byte offset. |
| buffer | The allocated buffer to hold the name component value. This buffer must remain valid during the life of the name component. It is the caller's responsibility to free this buffer if necessary when finished with it. |
| bufferLength | The number of bytes in the allocated buffer. This should be at least 9 bytes to hold a marker plus a 64-bit value. |
| ndn_Error ndn::NameLite::Component::setSequenceNumber | ( | uint64_t | sequenceNumber, |
| uint8_t * | buffer, | ||
| size_t | bufferLength | ||
| ) |
Set this name component to have the encoded sequence number according to NDN naming conventions for "Sequencing" (marker 0xFE).
http://named-data.net/doc/tech-memos/naming-conventions.pdf
| sequenceNumber | The sequence number. |
| buffer | The allocated buffer to hold the name component value. This buffer must remain valid during the life of the name component. It is the caller's responsibility to free this buffer if necessary when finished with it. |
| bufferLength | The number of bytes in the allocated buffer. This should be at least 9 bytes to hold a marker plus a 64-bit value. |
| ndn_Error ndn::NameLite::Component::setTimestamp | ( | uint64_t | timestamp, |
| uint8_t * | buffer, | ||
| size_t | bufferLength | ||
| ) |
Set this name component to have the encoded timestamp according to NDN naming conventions for "Timestamp" (marker 0xFC).
http://named-data.net/doc/tech-memos/naming-conventions.pdf
| timestamp | The number of microseconds since the UNIX epoch (Thursday, 1 January 1970) not counting leap seconds. |
| buffer | The allocated buffer to hold the name component value. This buffer must remain valid during the life of the name component. It is the caller's responsibility to free this buffer if necessary when finished with it. |
| bufferLength | The number of bytes in the allocated buffer. This should be at least 9 bytes to hold a marker plus a 64-bit value. |
| ndn_Error ndn::NameLite::Component::setVersion | ( | uint64_t | version, |
| uint8_t * | buffer, | ||
| size_t | bufferLength | ||
| ) |
Set this name component to have the encoded version number according to NDN naming conventions for "Versioning" (marker 0xFD).
http://named-data.net/doc/tech-memos/naming-conventions.pdf Note that this encodes the exact value of version without converting from a time representation.
| version | The version number. |
| buffer | The allocated buffer to hold the name component value. This buffer must remain valid during the life of the name component. It is the caller's responsibility to free this buffer if necessary when finished with it. |
| bufferLength | The number of bytes in the allocated buffer. This should be at least 9 bytes to hold a marker plus a 64-bit value. |
| uint64_t ndn::NameLite::Component::toNumber | ( | ) | const |
Interpret the name component as a network-ordered number and return an integer.
| ndn_Error ndn::NameLite::Component::toNumberWithMarker | ( | uint8_t | marker, |
| uint64_t & | result | ||
| ) | const |
Interpret the name component as a network-ordered number with a marker and return an integer.
| marker | The required first byte of the component. |
| result | Return the integer number. |
| ndn_Error ndn::NameLite::Component::toNumberWithPrefix | ( | const uint8_t * | prefix, |
| size_t | prefixLength, | ||
| uint64_t & | result | ||
| ) | const |
Interpret the name component as a network-ordered number with a prefix and return an integer.
| prefix | The required prefix of the component. |
| prefixLength | The length of prefix. |
| result | Return the integer number. |
| ndn_Error ndn::NameLite::Component::toSegment | ( | uint64_t & | result | ) | const |
Interpret this name component as a segment number according to NDN naming conventions for "Segment number" (marker 0x00).
http://named-data.net/doc/tech-memos/naming-conventions.pdf
| result | Return the integer segment number. |
| ndn_Error ndn::NameLite::Component::toSegmentOffset | ( | uint64_t & | result | ) | const |
Interpret this name component as a segment byte offset according to NDN naming conventions for segment "Byte offset" (marker 0xFB).
http://named-data.net/doc/tech-memos/naming-conventions.pdf
| result | Return the integer segment byte offset. |
| ndn_Error ndn::NameLite::Component::toSequenceNumber | ( | uint64_t & | result | ) | const |
Interpret this name component as a sequence number according to NDN naming conventions for "Sequencing" (marker 0xFE).
http://named-data.net/doc/tech-memos/naming-conventions.pdf
| result | Return the integer sequence number. |
| ndn_Error ndn::NameLite::Component::toTimestamp | ( | uint64_t & | result | ) | const |
Interpret this name component as a timestamp according to NDN naming conventions for "Timestamp" (marker 0xFC).
http://named-data.net/doc/tech-memos/naming-conventions.pdf
| result | Return the number of microseconds since the UNIX epoch (Thursday, 1 January 1970) not counting leap seconds. |
| ndn_Error ndn::NameLite::Component::toVersion | ( | uint64_t & | result | ) | const |
Interpret this name component as a version number according to NDN naming conventions for "Versioning" (marker 0xFD).
Note that this returns the exact number from the component without converting it to a time representation.
| result | Return the integer version number. |
1.8.6