![]() |
ndn-lite
|
#include "name.h"
Functions | |
int | ndn_name_init (ndn_name_t *name, const name_component_t *components, uint32_t size) |
Init a Name structure. More... | |
int | ndn_name_tlv_decode (ndn_decoder_t *decoder, ndn_name_t *name) |
Decode the Name from wire format (TLV block). More... | |
int | ndn_name_from_block (ndn_name_t *name, const uint8_t *block_value, uint32_t block_size) |
Decode an Name TLV block into an Name. More... | |
int | ndn_name_append_component (ndn_name_t *name, const name_component_t *component) |
Appends a component to the end of a name. More... | |
int | ndn_name_from_string (ndn_name_t *name, const char *string, uint32_t size) |
Init a name block from a string. More... | |
int | ndn_name_tlv_encode (ndn_encoder_t *encoder, const ndn_name_t *name) |
Encode the Name structure into wire format (TLV block). More... | |
int | ndn_name_compare (const ndn_name_t *lhs, const ndn_name_t *rhs) |
Compare two Name. More... | |
int | ndn_name_compare_sub_names (const ndn_name_t *lhs, int lhs_b, int lhs_e, const ndn_name_t *rhs, int rhs_b, int rhs_e) |
Compare sub-names of two names. More... | |
int | ndn_name_is_prefix_of (const ndn_name_t *lhs, const ndn_name_t *rhs) |
Compare two Name based on the canonical order, to see whether a name is the prefix of another. More... | |
int | ndn_name_compare_block (const uint8_t *lhs_block_value, uint32_t lhs_block_size, const uint8_t *rhs_block_value, uint32_t rhs_block_size) |
Compare two encoded Names. More... | |
int ndn_name_append_component | ( | ndn_name_t * | name, |
const name_component_t * | component | ||
) |
Appends a component to the end of a name.
This function will do memory copy.
name. | Output. The name to append to. |
component. | Input. The name component to append with. |
int ndn_name_compare | ( | const ndn_name_t * | lhs, |
const ndn_name_t * | rhs | ||
) |
Compare two Name.
lhs. | Input. Left-hand-side Name. |
rhs. | Input. Right-hand-side Name. |
lhs
== rhs
. int ndn_name_compare_block | ( | const uint8_t * | lhs_block_value, |
uint32_t | lhs_block_size, | ||
const uint8_t * | rhs_block_value, | ||
uint32_t | rhs_block_size | ||
) |
Compare two encoded Names.
lhs_block_value. | Input. Left-hand-side encoded Name block value. |
lhs_block_size. | Input. Left-hand-side encoded Name block size. |
rhs_block_value. | Input. Right-hand-side encoded Name block value. |
rhs_block_size. | Input. Right-hand-side encoded Name block size. |
lhs
== rhs
. lhs
> rhs
and rhs
is not a prefix of lhs
. lhs
> rhs
and rhs
is a proper prefix of lhs
. lhs
< rhs
and lhs
is not a prefix of rhs
. lhs
< rhs
and lhs
is a proper prefix of rhs
. int ndn_name_compare_sub_names | ( | const ndn_name_t * | lhs, |
int | lhs_b, | ||
int | lhs_e, | ||
const ndn_name_t * | rhs, | ||
int | rhs_b, | ||
int | rhs_e | ||
) |
Compare sub-names of two names.
lhs. | Input. Left-hand-side Name. |
lhs_b. | Input. Beginning index of left-hand-side-name. |
lhs_e. | Input. Ending index of left-hand-side-name (should be one more than last index to compare) |
rhs. | Input. Right-hand-side Name. |
rhs_b. | Input. Beginning index of right-hand-side-name. |
rhs_e. | Input. Ending index of right-hand-side-name (should be one more than last index to compare) |
lhs
from lhs_b to lhs_e-1 == rhs
from rhs_b to rhs_e-1. int ndn_name_from_block | ( | ndn_name_t * | name, |
const uint8_t * | block_value, | ||
uint32_t | block_size | ||
) |
Decode an Name TLV block into an Name.
This function will do memory copy.
name. | Output. The Name to which the TLV block will be decoded. |
block. | Input. The Name TLV. |
int ndn_name_from_string | ( | ndn_name_t * | name, |
const char * | string, | ||
uint32_t | size | ||
) |
Init a name block from a string.
This funcition will do memory copy and only support regular string; not support URI currently.
name. | Output. The Name to be inited. |
string. | Input. The string from which Name is inited. |
size. | Input. Size of the input string. |
int ndn_name_init | ( | ndn_name_t * | name, |
const name_component_t * | components, | ||
uint32_t | size | ||
) |
Init a Name structure.
This function will do memory copy.
name. | Output. The Name Structure to be inited. |
component. | Input. The name component array from which Name is inited. |
size. | Input. Size of input name component array. |
int ndn_name_is_prefix_of | ( | const ndn_name_t * | lhs, |
const ndn_name_t * | rhs | ||
) |
Compare two Name based on the canonical order, to see whether a name is the prefix of another.
lhs. | Input. Left-hand-side Name. |
rhs. | Input. Right-hand-side Name. |
lhs
is the prefix of rhs
. int ndn_name_tlv_decode | ( | ndn_decoder_t * | decoder, |
ndn_name_t * | name | ||
) |
Decode the Name from wire format (TLV block).
decoder. | Input. The decoder who keeps the decoding result and the state. |
name. | Output. The Name decoded from TLV block. |
int ndn_name_tlv_encode | ( | ndn_encoder_t * | encoder, |
const ndn_name_t * | name | ||
) |
Encode the Name structure into wire format (TLV block).
This function will do memory copy. Need to call ndn_name_probe_block_size() to initialize output block in advance.
encoder. | Output. The encoder who keeps the encoding result and the state. |
name. | Input. The Name structure to be encoded. |