#include "../ndn-constants.h"
#include "../ndn-error-code.h"
#include <inttypes.h>
#include <string.h>
Go to the source code of this file.
◆ ndn_frag_assembler_t
The structure to keep the state when assembling fragments.
◆ ndn_fragmenter_t
NDN-Lite reuses the ndn-riot fragmentation header (3 bytes header)
0 1 2 0 1 2 3 8 15 23 +-+-+–+-—+-------------------—+ |1|X|MF|Seq#| Identification | +-+-+–+-—+-------------------—+
First bit: header bit, always 1 (indicating the fragmentation header) Second bit: reserved, always 0 Third bit: MF bit 4th to 8th bit: sequence number (5 bits, encoding up to 31 fragments) 9th to 24th bit: identification (2-byte random number)The structure to keep the state when doing fragmentation.
◆ ndn_frag_assembler_assemble_frag()
static int ndn_frag_assembler_assemble_frag |
( |
ndn_frag_assembler_t * |
assembler, |
|
|
uint8_t * |
frag, |
|
|
uint32_t |
fra_size |
|
) |
| |
|
inlinestatic |
Assemble a fragment into the assembler.
- Parameters
-
assembler. | Output. The assembler used to keep the assembled packet and the state. |
frag. | Input. The fragment packet buffer. |
fra_size. | Input. The size of the fragment packet buffer. |
- Returns
- 0 if there is no error.
◆ ndn_frag_assembler_init()
static void ndn_frag_assembler_init |
( |
ndn_frag_assembler_t * |
assembler, |
|
|
uint8_t * |
original, |
|
|
uint32_t |
original_max_size |
|
) |
| |
|
inlinestatic |
Init an assembler.
- Parameters
-
assembler. | Output. The assembler to be inited. |
original. | Input. The buffer used to keep the assembled packet. |
original_max_size. | Input. The size of the buffer used to keep the assembled packet. |
◆ ndn_fragmenter_fragment()
static int ndn_fragmenter_fragment |
( |
ndn_fragmenter_t * |
fragmenter, |
|
|
uint8_t * |
fragmented |
|
) |
| |
|
inlinestatic |
Generate one fragmented packet.
- Parameters
-
fragmenter. | Input/Output. The fragmenter used to keep the original packet and the state. |
fragmented. | Output. The buffer to keep the fragmented packet. The buffer size should at least be the fragmenter->fragment_max_size. |
- Returns
- 0 if there is no error.
◆ ndn_fragmenter_init()
static void ndn_fragmenter_init |
( |
ndn_fragmenter_t * |
fragmenter, |
|
|
const uint8_t * |
original, |
|
|
uint32_t |
original_size, |
|
|
uint32_t |
fragment_max_size, |
|
|
uint16_t |
frag_identifier |
|
) |
| |
|
inlinestatic |
Init a fragmenter.
- Parameters
-
fragmenter. | Output. The fragmenter to be inited. |
original. | Input. The original packet buffer. |
original_size. | Input. The size of the original packet buffer. |
fragment_max_size. | Input. The max size of each fragment. This value is obtained from protocol-specific MTU. |
frag_identifier. | Input. The identifier of the fragments generated from the original packet. |