Class to representing binary blob of NDN name component. More...
#include <name-component.h>
Public Member Functions | |
Component () | |
Default constructor an empty exclude. | |
Component (const std::string &uri) | |
Create component from URI encoded string. More... | |
Component (std::string::const_iterator begin, std::string::const_iterator end) | |
Create component from URI encoded string, with string specified by a pair of iterators. More... | |
Component (const void *buf, size_t length) | |
Create component using a binary blob. More... | |
int | compare (const Component &other) const |
Apply canonical ordering on component comparison. More... | |
bool | operator<= (const Component &other) const |
Apply canonical ordering on component comparison (less or equal) More... | |
bool | operator< (const Component &other) const |
Apply canonical ordering on component comparison (less) More... | |
bool | operator>= (const Component &other) const |
Apply canonical ordering on component comparison (greater or equal) More... | |
bool | operator> (const Component &other) const |
Apply canonical ordering on component comparison (greater) More... | |
Component & | fromUri (const std::string &uri) |
Create component from URI encoded string. More... | |
Component & | fromUri (std::string::const_iterator begin, std::string::const_iterator end) |
Create component from URI encoded string, with string specified by a pair of iterators. More... | |
Component & | fromNumber (uint64_t number) |
Create network-ordered numeric component. More... | |
Component & | fromNumberWithMarker (uint64_t number, unsigned char marker) |
Create network-ordered numeric component to the name with marker. More... | |
std::string | toBlob () const |
Convert binary blob name component to std::string (no conversion is made) More... | |
void | toBlob (std::ostream &os) const |
Write blob of the name component to the specified output stream. More... | |
std::string | toUri () const |
Convert binary blob name component to std::string, escaping all non-printable characters in URI format. More... | |
void | toUri (std::ostream &os) const |
Write name as URI to the specified output stream. More... | |
uint64_t | toNumber () const |
Convert binary blob name component (network-ordered number) to number. More... | |
uint64_t | toNumberWithMarker (unsigned char marker) const |
Convert binary blob name component (network-ordered number) to number, using appropriate marker from the naming convention. More... | |
uint64_t | toSeqNum () const |
Convert binary blob name component, assuming sequence number naming convention (marker = 0x00) More... | |
uint64_t | toControlNum () const |
Convert binary blob name component, assuming control number naming convention (marker = 0xC1) More... | |
uint64_t | toBlkId () const |
Convert binary blob name component, assuming block ID naming convention (marker = 0xFB) More... | |
uint64_t | toVersion () const |
Convert binary blob name component, assuming time-stamping version naming convention (marker = 0xFD) More... | |
Public Member Functions inherited from ns3::ndn::Blob | |
Blob () | |
Creates an empty blob. | |
Blob (const std::string &data) | |
Blob (const void *buf, size_t length) | |
char * | buf () |
Get pointer to the first byte of the binary blob. | |
const char * | buf () const |
Get const pointer to the first byte of the binary blob. | |
iterator | begin () |
const_iterator | begin () const |
iterator | end () |
const_iterator | end () const |
size_t | size () const |
void | swap (Blob &x) |
void | push_back (value_type val) |
bool | empty () const |
Blob & | operator= (const Blob &other) |
reference | operator[] (size_type pos) |
const_reference | operator[] (size_type pos) const |
char | getItem (size_type pos) const |
void | clear () |
Additional Inherited Members | |
Public Types inherited from ns3::ndn::Blob | |
typedef std::vector< char > | base |
typedef base::value_type | value_type |
typedef base::pointer | pointer |
typedef base::const_pointer | const_pointer |
typedef base::reference | reference |
typedef base::const_reference | const_reference |
typedef base::iterator | iterator |
typedef base::const_iterator | const_iterator |
typedef base::const_reverse_iterator | const_reverse_iterator |
typedef base::reverse_iterator | reverse_iterator |
typedef base::size_type | size_type |
typedef base::difference_type | difference_type |
typedef base::allocator_type | allocator_type |
Class to representing binary blob of NDN name component.
This class is based on Blob (std::vector<char>) and just provides several helpers to work with name components, as well as operator to apply canonical ordering on name components
Definition at line 28 of file name-component.h.
ns3::ndn::name::Component::Component | ( | const std::string & | uri | ) |
Create component from URI encoded string.
uri | URI encoded name component (convert escaped with % characters) |
Definition at line 31 of file name-component.cc.
ns3::ndn::name::Component::Component | ( | std::string::const_iterator | begin, |
std::string::const_iterator | end | ||
) |
Create component from URI encoded string, with string specified by a pair of iterators.
begin | begin iterator pointing to the URI encoded name |
end | end iterator |
Definition at line 36 of file name-component.cc.
ns3::ndn::name::Component::Component | ( | const void * | buf, |
size_t | length | ||
) |
Create component using a binary blob.
buf | pointer to first byte of binary blob to store as a name component |
length | length of the binary blob |
Definition at line 41 of file name-component.cc.
int ns3::ndn::name::Component::compare | ( | const Component & | other | ) | const |
Apply canonical ordering on component comparison.
Definition at line 84 of file name-component.cc.
Component & ns3::ndn::name::Component::fromNumber | ( | uint64_t | number | ) |
Create network-ordered numeric component.
number | number to be encoded and added as a component |
Number is encoded and added in network order. Tail zero-bytes are not included. For example, if the number is 1, then 1-byte binary blob will be added 0x01. If the number is 256, then 2 binary blob will be added: 0x01 0x01
If the number is zero, an empty component will be created
Definition at line 102 of file name-component.cc.
Referenced by ns3::ndn::Name::appendNumber().
Component & ns3::ndn::name::Component::fromNumberWithMarker | ( | uint64_t | number, |
unsigned char | marker | ||
) |
Create network-ordered numeric component to the name with marker.
number | number to be encoded and added as a component |
marker | byte marker, specified by the desired naming convention |
Currently defined naming conventions of the marker:
This version is almost exactly as appendNumber, with exception that it adds initial marker. The number is formatted in the exactly the same way.
Definition at line 114 of file name-component.cc.
Referenced by ns3::ndn::Name::appendNumberWithMarker().
Component & ns3::ndn::name::Component::fromUri | ( | const std::string & | uri | ) |
Create component from URI encoded string.
uri | URI encoded name component (convert escaped with % characters) |
Definition at line 49 of file name-component.cc.
References ns3::ndn::error::get_pos().
Component & ns3::ndn::name::Component::fromUri | ( | std::string::const_iterator | begin, |
std::string::const_iterator | end | ||
) |
Create component from URI encoded string, with string specified by a pair of iterators.
begin | begin iterator pointing to the URI encoded name |
end | end iterator |
Definition at line 67 of file name-component.cc.
References ns3::ndn::error::get_pos().
|
inline |
Apply canonical ordering on component comparison (less)
Definition at line 246 of file name-component.h.
|
inline |
Apply canonical ordering on component comparison (less or equal)
Definition at line 240 of file name-component.h.
|
inline |
Apply canonical ordering on component comparison (greater)
Definition at line 258 of file name-component.h.
|
inline |
Apply canonical ordering on component comparison (greater or equal)
Definition at line 252 of file name-component.h.
|
inline |
Convert binary blob name component, assuming block ID naming convention (marker = 0xFB)
comp | name component to be converted |
Definition at line 276 of file name-component.h.
std::string ns3::ndn::name::Component::toBlob | ( | ) | const |
Convert binary blob name component to std::string (no conversion is made)
comp | name component to be converted |
Definition at line 129 of file name-component.cc.
void ns3::ndn::name::Component::toBlob | ( | std::ostream & | os | ) | const |
Write blob of the name component to the specified output stream.
os | output stream |
Definition at line 135 of file name-component.cc.
|
inline |
Convert binary blob name component, assuming control number naming convention (marker = 0xC1)
comp | name component to be converted |
Definition at line 270 of file name-component.h.
uint64_t ns3::ndn::name::Component::toNumber | ( | ) | const |
Convert binary blob name component (network-ordered number) to number.
comp | name component to be converted |
Definition at line 192 of file name-component.cc.
uint64_t ns3::ndn::name::Component::toNumberWithMarker | ( | unsigned char | marker | ) | const |
Convert binary blob name component (network-ordered number) to number, using appropriate marker from the naming convention.
comp | name component to be converted |
marker | required marker from the naming convention |
If the required marker does not exist, an exception will be thrown
Definition at line 204 of file name-component.cc.
|
inline |
Convert binary blob name component, assuming sequence number naming convention (marker = 0x00)
comp | name component to be converted |
Definition at line 264 of file name-component.h.
std::string ns3::ndn::name::Component::toUri | ( | ) | const |
Convert binary blob name component to std::string, escaping all non-printable characters in URI format.
comp | name component to be converted |
Definition at line 141 of file name-component.cc.
Referenced by ns3::ndn::Exclude::excludeRange().
void ns3::ndn::name::Component::toUri | ( | std::ostream & | os | ) | const |
Write name as URI to the specified output stream.
os | output stream |
Definition at line 149 of file name-component.cc.
|
inline |
Convert binary blob name component, assuming time-stamping version naming convention (marker = 0xFD)
comp | name component to be converted |
Definition at line 282 of file name-component.h.