9 #ifndef NDN_ENCODING_NAME_COMPONENT_H 10 #define NDN_ENCODING_NAME_COMPONENT_H 60 component->
type = type;
77 const uint8_t* value, uint32_t size)
81 component->
type = type;
82 memcpy(component->
value, value, size);
83 component->
size = size;
98 if (
string[size - 1] ==
'\0')
100 (
const uint8_t*)
string, size - 1);
103 (
const uint8_t*)
string, size);
139 static inline uint32_t
158 #endif // NDN_ENCODING_NAME_COMPONENT_H static uint32_t name_component_probe_block_size(const name_component_t *component)
Probe the size of a Name component TLV block before encoding it from a Name Component structure.
Definition: name-component.h:140
struct name_component_block name_component_block_t
The structure to represent the wire format name component block.
uint8_t value[NDN_NAME_COMPONENT_BLOCK_SIZE]
Name component TLV block.
Definition: name-component.h:45
The structure to keep the state when doing NDN TLV decoding.
Definition: decoder.h:21
static int name_component_from_string(name_component_t *component, const char *string, uint32_t size)
Init a Name Component structure from string.
Definition: name-component.h:96
struct name_component name_component_t
The structure to represent the Name Component.
static int name_component_from_buffer(name_component_t *component, uint32_t type, const uint8_t *value, uint32_t size)
Init a Name Component structure from caller supplied memory block.
Definition: name-component.h:76
uint32_t size
The size of block.
Definition: name-component.h:49
int name_component_compare(const name_component_t *lhs, const name_component_t *rhs)
Compare two name components.
Definition: name-component.c:41
uint32_t type
The component type.
Definition: name-component.h:27
#define NDN_NAME_COMPONENT_BLOCK_SIZE
Definition: ndn-constants.h:16
int name_component_from_block(name_component_t *component, const name_component_block_t *block)
Decode an Name Component TLV block into an Name Component.
Definition: name-component.c:33
static uint32_t encoder_probe_block_size(uint32_t type, uint32_t payload_size)
Probe the size of a TLV block.
Definition: encoder.h:82
uint8_t value[NDN_NAME_COMPONENT_BUFFER_SIZE]
The value which name component holds.
Definition: name-component.h:31
The structure to represent the Name Component.
Definition: name-component.h:23
The structure to represent the wire format name component block.
Definition: name-component.h:41
#define NDN_OVERSIZE
The object given is larger than expected.
Definition: ndn-error-code.h:33
int name_component_tlv_encode(ndn_encoder_t *encoder, const name_component_t *component)
Encode the Name Component structure into wire format (TLV block).
Definition: name-component.c:53
The structure to keep the state when doing NDN TLV encoding.
Definition: encoder.h:31
uint32_t size
The size of component value buffer.
Definition: name-component.h:35
int name_component_tlv_decode(ndn_decoder_t *decoder, name_component_t *component)
Decode the Name Component from wire format (TLV block).
Definition: name-component.c:12
static void name_component_init(name_component_t *component, uint32_t type)
Init a Name Component structure.
Definition: name-component.h:58
#define NDN_NAME_COMPONENT_BUFFER_SIZE
Definition: ndn-constants.h:15