|
NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
|
API Documentation
|
Go to the documentation of this file.
22 #ifndef NDN_NAME_COMPONENT_HPP
23 #define NDN_NAME_COMPONENT_HPP
179 template<
class Iterator>
188 template<
class Iterator>
214 template<encoding::Tag TAG>
660 #endif // NDN_NAME_COMPONENT_HPP
Common includes and macros used throughout the library.
bool equals(const Component &other) const
Check if this is the same component as other.
static Component fromTimestamp(const time::system_clock::TimePoint &timePoint)
Create sequence number component using NDN naming conventions.
bool isByteOffset() const
Check if the component is a byte offset per NDN naming conventions.
static Component fromNumber(uint64_t number, uint32_t type=tlv::GenericNameComponent)
Create a component encoded as nonNegativeInteger.
bool isNumber() const
Check if the component is a nonNegativeInteger.
static Component fromByteOffset(uint64_t offset)
Create byte offset component using NDN naming conventions.
Convention getConventionEncoding()
Return which Naming Conventions style to use while encoding.
@ DEFAULT
ALTERNATE, unless NDN_NAME_ALT_URI environment variable is set to '0'.
bool isSegment() const
Check if the component is a segment number per NDN naming conventions.
bool isSegmentOffset() const
static Component fromNumberWithMarker(uint8_t marker, uint64_t number)
Create a component encoded as NameComponentWithMarker.
bool isGeneric() const
Check if the component is GenericComponent.
Component(ConstBufferPtr buffer)
Construct a GenericNameComponent, using TLV-VALUE from buffer.
size_t value_size() const noexcept
Return the size of TLV-VALUE, aka TLV-LENGTH.
uint64_t toNumberWithMarker(uint8_t marker) const
Interpret this name component as NameComponentWithMarker.
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(Component)
bool isSequenceNumber() const
Check if the component is a sequence number per NDN naming conventions.
General-purpose automatically managed/resized buffer.
void setConventionEncoding(Convention convention)
Set which Naming Conventions style to use while encoding.
void toUri(std::ostream &os, UriFormat format=UriFormat::DEFAULT) const
Write *this to the output stream, escaping characters according to the NDN URI format.
int compare(const Component &other) const
Compare this to the other Component using NDN canonical ordering.
uint64_t toSegmentOffset() const
uint64_t toByteOffset() const
Interpret as byte offset component using NDN naming conventions.
friend bool operator!=(const Component &lhs, const Component &rhs)
uint64_t toVersion() const
Interpret as version component using NDN naming conventions.
uint64_t toNumber() const
Interpret this name component as nonNegativeInteger.
friend bool operator<=(const Component &lhs, const Component &rhs)
void setConventionDecoding(Convention convention)
Set which Naming Conventions style(s) to accept while decoding.
static Component fromParametersSha256Digest(ConstBufferPtr digest)
Create ParametersSha256DigestComponent component.
void wireDecode(const Block &wire)
Decode from the wire format.
Component getSuccessor() const
Get the successor of this name component.
friend bool operator==(const Component &lhs, const Component &rhs)
uint64_t toSequenceNumber() const
Interpret as sequence number component using NDN naming conventions.
#define NDN_CXX_NODISCARD
static Component fromVersion(uint64_t version)
Create version component using NDN naming conventions.
uint32_t type() const
Return the TLV-TYPE of the Block.
Component(uint32_t type, Iterator first, Iterator last)
Construct a NameComponent of TLV-TYPE type, copying TLV-VALUE from a range.
bool isVersion() const
Check if the component is a version per NDN naming conventions.
Component(Iterator first, Iterator last)
Construct a GenericNameComponent, copying TLV-VALUE from a range.
bool isNumberWithMarker(uint8_t marker) const
Check if the component is a NameComponentWithMarker per NDN naming conventions rev1.
uint64_t toSegment() const
Interpret as segment number component using NDN naming conventions.
Convention
Identify a style of NDN Naming Conventions.
bool isTimestamp() const
Check if the component is a timestamp per NDN naming conventions.
bool isImplicitSha256Digest() const
Check if the component is ImplicitSha256DigestComponent.
static Component fromSegment(uint64_t segmentNo)
Create segment number component using NDN naming conventions.
static Component fromSequenceNumber(uint64_t seqNo)
Create sequence number component using NDN naming conventions.
friend bool operator<(const Component &lhs, const Component &rhs)
NDN_CXX_NODISCARD bool empty() const
friend bool operator>(const Component &lhs, const Component &rhs)
static Component fromSegmentOffset(uint64_t offset)
@ CANONICAL
always use <type-number>=<percent-encoded-value> format
friend std::ostream & operator<<(std::ostream &os, const Component &component)
const Block & wireEncode() const
Encode to a wire format.
@ ALTERNATE
prefer alternate format when available
time::system_clock::TimePoint toTimestamp() const
Interpret as timestamp component using NDN naming conventions.
const uint8_t * value() const noexcept
Return a raw pointer to the beginning of TLV-VALUE.
Represents a name component.
Represents a TLV element of NDN packet format.
static Component fromEscapedString(const char *input)
Decode NameComponent from a URI component.
size_t size() const
Return the size of the encoded wire, i.e.
@ TYPED
typed name components (revision 2)
@ MARKER
component markers (revision 1)
Component(uint32_t type, const Buffer &buffer)
Construct a NameComponent of TLV-TYPE type, copying TLV-VALUE from buffer.
static Component fromImplicitSha256Digest(ConstBufferPtr digest)
Create ImplicitSha256DigestComponent component.
friend bool operator>=(const Component &lhs, const Component &rhs)
Component(const uint8_t *value, size_t count)
Construct a GenericNameComponent, copying count bytes at value as TLV-VALUE.
static Component fromEscapedString(const char *input, size_t beginOffset, size_t endOffset)
Decode NameComponent from a URI component.
Component(uint32_t type=tlv::GenericNameComponent)
Construct a NameComponent of TLV-TYPE type, using empty TLV-VALUE.
const uint8_t * wire() const
Return a raw pointer to the beginning of the encoded wire.
Error(const char *expectedType, uint32_t actualType)
bool isParametersSha256Digest() const
Check if the component is ParametersSha256DigestComponent.
Block makeBinaryBlock(uint32_t type, const uint8_t *value, size_t length)
Create a TLV block copying TLV-VALUE from raw buffer.
shared_ptr< const Buffer > ConstBufferPtr
Component(const Buffer &buffer)
Construct a GenericNameComponent, copying TLV-VALUE from buffer.
Copyright (c) 2011-2015 Regents of the University of California.
UriFormat
Identify a format of URI representation.
Convention getConventionDecoding()
Return which Naming Conventions style(s) to accept while decoding.