ndn-lite
Functions
interest.c File Reference
#include "interest.h"
#include "../security/ndn-lite-sha.h"

Functions

static uint32_t ndn_interest_probe_block_value_size (const ndn_interest_t *interest)
 
int ndn_interest_from_block (ndn_interest_t *interest, const uint8_t *block_value, uint32_t block_size)
 Decode an Interest TLV block into an ndn_interest_t. More...
 
int ndn_interest_tlv_encode (ndn_encoder_t *encoder, ndn_interest_t *interest)
 Encode the Interest into wire format (TLV block). More...
 
int ndn_interest_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 Interests' names. More...
 

Function Documentation

◆ ndn_interest_from_block()

int ndn_interest_from_block ( ndn_interest_t interest,
const uint8_t *  block_value,
uint32_t  block_size 
)

Decode an Interest TLV block into an ndn_interest_t.

Parameters
interest.Output. The Interest to which the TLV block will be decoded.
block_value.Input. The Interest TLV block buffer.
block_size.Input. The size of the Interest TLV block buffer.
Returns
0 if decoding is successful.

◆ ndn_interest_name_compare_block()

int ndn_interest_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 Interests' names.

Parameters
lhs_block_value.Input. Left-hand-side encoded Interest block value.
lhs_block_size.Input. Left-hand-side encoded Interest block size.
rhs_block_value.Input. Right-hand-side encoded Interest block value.
rhs_block_size.Input. Right-hand-side encoded Interest block size.
Returns
0 if lhs == rhs.
1, if lhs > rhs and rhs is not a prefix of lhs.
2, if lhs > rhs and rhs is a proper prefix of lhs.
-1, if lhs < rhs and lhs is not a prefix of rhs.
-2, if lhs < rhs and lhs is a proper prefix of rhs.

◆ ndn_interest_probe_block_value_size()

static uint32_t ndn_interest_probe_block_value_size ( const ndn_interest_t interest)
static

◆ ndn_interest_tlv_encode()

int ndn_interest_tlv_encode ( ndn_encoder_t encoder,
ndn_interest_t interest 
)

Encode the Interest into wire format (TLV block).

This function is only used for unsigned Interest.

Parameters
encoder.Output. The encoder who keeps the encoding result and the state.
interest.Input. The Interest to be encoded.
Returns
0 if there is no error.