![]() |
ndn-lite
|
#include "../ndn-constants.h"#include "../ndn-error-code.h"#include "../ndn-enums.h"#include <inttypes.h>#include <string.h>Go to the source code of this file.
Data Structures | |
| struct | ndn_buffer |
| struct | ndn_encoder |
| The structure to keep the state when doing NDN TLV encoding. More... | |
Typedefs | |
| typedef struct ndn_buffer | ndn_buffer_t |
| typedef struct ndn_encoder | ndn_encoder_t |
| The structure to keep the state when doing NDN TLV encoding. More... | |
Functions | |
| static void | encoder_init (ndn_encoder_t *encoder, uint8_t *block_value, uint32_t block_max_size) |
| Init an encoder by setting the buffer to keep the encoding output and its size. More... | |
| static uint32_t | encoder_get_var_size (uint32_t var) |
| Probe the size of a variable-length type (T) or length (L). More... | |
| static uint32_t | encoder_probe_block_size (uint32_t type, uint32_t payload_size) |
| Probe the size of a TLV block. More... | |
| static int | encoder_append_var (ndn_encoder_t *encoder, uint32_t var) |
| Append a variable-length type (T) or length (L) to the wire format buffer. More... | |
| static int | encoder_append_type (ndn_encoder_t *encoder, uint32_t type) |
| Append a variable-length type (T) to the wire format buffer. More... | |
| static int | encoder_append_length (ndn_encoder_t *encoder, uint32_t length) |
| Append a variable-length length (L) to the wire format buffer. More... | |
| static int | encoder_append_raw_buffer_value (ndn_encoder_t *encoder, const uint8_t *buffer, uint32_t size) |
| Append the byte array as the value (V) to the wire format buffer. More... | |
| static int | encoder_append_byte_value (ndn_encoder_t *encoder, uint8_t value) |
| Append a single byte as the value (V) to the wire format buffer. More... | |
| static int | encoder_append_uint16_value (ndn_encoder_t *encoder, uint16_t value) |
| Append a uint16_t as the value (V) to the wire format buffer. More... | |
| static int | encoder_append_uint32_value (ndn_encoder_t *encoder, uint32_t value) |
| Append a uint32_t as the value (V) to the wire format buffer. More... | |
| static int | encoder_append_uint64_value (ndn_encoder_t *encoder, uint64_t value) |
| Append a uint64_t as the value (V) to the wire format buffer. More... | |
| static int | encoder_probe_uint_length (uint64_t value) |
| Probe the length of a non-negative int as the value (V). More... | |
| static int | encoder_append_uint_value (ndn_encoder_t *encoder, uint64_t value) |
| Append a non-negative int as the value (V) to the wire format buffer. More... | |
| static int | encoder_move_forward (ndn_encoder_t *encoder, uint32_t step) |
| Move the encoder's offset forward by. More... | |
| static int | encoder_move_backward (ndn_encoder_t *encoder, uint32_t step) |
| Move the encoder's offset backward by. More... | |
| static uint32_t | encoder_get_offset (const ndn_encoder_t *encoder) |
| Get the offset of the encoder. More... | |
| typedef struct ndn_buffer ndn_buffer_t |
| typedef struct ndn_encoder ndn_encoder_t |
The structure to keep the state when doing NDN TLV encoding.
|
inlinestatic |
Append a single byte as the value (V) to the wire format buffer.
| encoder. | Output. The encoder will keep the encoding result and the offset will be updated. |
| value. | Input. The byte to be encoded. |
|
inlinestatic |
Append a variable-length length (L) to the wire format buffer.
| encoder. | Output. The encoder will keep the encoding result and the offset will be updated. |
| length. | Input. The variable-length length (L). |
|
inlinestatic |
Append the byte array as the value (V) to the wire format buffer.
| encoder. | Output. The encoder will keep the encoding result and the offset will be updated. |
| buffer. | Input. The buffer to be encoded. |
| size. | Input. The size of the buffer to be encoded. |
|
inlinestatic |
Append a variable-length type (T) to the wire format buffer.
| encoder. | Output. The encoder will keep the encoding result and the offset will be updated. |
| type. | Input. The variable-length type (T). |
|
inlinestatic |
Append a uint16_t as the value (V) to the wire format buffer.
| encoder. | Output. The encoder will keep the encoding result and the offset will be updated. |
| value. | Input. The uint16_t to be encoded. |
|
inlinestatic |
Append a uint32_t as the value (V) to the wire format buffer.
| encoder. | Output. The encoder will keep the encoding result and the offset will be updated. |
| value. | Input. The uint32_t to be encoded. |
|
inlinestatic |
Append a uint64_t as the value (V) to the wire format buffer.
| encoder. | Output. The encoder will keep the encoding result and the offset will be updated. |
| value. | Input. The uint64_t to be encoded. |
|
inlinestatic |
Append a non-negative int as the value (V) to the wire format buffer.
TLV-LENGTH of the TLV element MUST be either 1, 2, 4, or 8.
| encoder. | Output. The encoder will keep the encoding result and the offset will be updated. |
| value. | Input. The uint to be encoded. |
|
inlinestatic |
Append a variable-length type (T) or length (L) to the wire format buffer.
| encoder. | Output. The encoder will keep the encoding result and the offset will be updated. |
| var. | Input. The variable-length type (T) or length (L). |
|
inlinestatic |
Get the offset of the encoder.
| encoder. | Input. The encoder's offset will be updated. |
|
inlinestatic |
Probe the size of a variable-length type (T) or length (L).
| var. | Input. The value of the variable-length type (T) or length (L). |
|
inlinestatic |
Init an encoder by setting the buffer to keep the encoding output and its size.
| encoder. | Output. The encoder to be inited. |
| block_value. | Input. The buffer to keep the wire format buffer. |
| block_max_size. | Input. The size of wire format buffer. |
|
inlinestatic |
Move the encoder's offset backward by.
| step. | |
| encoder. | Output. The encoder whose offset will be updated. |
| step. | Input. The step by which the offset will be moved. |
|
inlinestatic |
Move the encoder's offset forward by.
| step. | |
| encoder. | Output. The encoder whose offset will be updated. |
| step. | Input. The step by which the offset will be moved. |
|
inlinestatic |
Probe the size of a TLV block.
This function is used to check whether the output buffer size is large enough.
| type. | Input. The value of the type (T). |
| payload_size. | Input. The value of length (L). |
|
inlinestatic |
Probe the length of a non-negative int as the value (V).
TLV-LENGTH of the TLV element MUST be either 1, 2, 4, or 8.
| value. | Input. The uint to be checked. |
1.8.15