ndn-lite
Data Structures | Typedefs | Functions
interest.h File Reference
#include "name.h"
#include "signature.h"
#include "../security/ndn-lite-crypto-key.h"

Go to the source code of this file.

Data Structures

struct  interest_params
 The structure to represent the Interest parameters element. More...
 
struct  ndn_interest
 The structure to represent an NDN Interest packet. More...
 

Typedefs

typedef struct interest_params interest_params_t
 The structure to represent the Interest parameters element. More...
 
typedef struct ndn_interest ndn_interest_t
 The structure to represent an NDN Interest packet. More...
 

Functions

static void ndn_interest_init (ndn_interest_t *interest)
 Init an Interest packet. More...
 
static void ndn_interest_from_name (ndn_interest_t *interest, const ndn_name_t *name)
 Init an Interest packet from a. More...
 
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...
 
static void ndn_interest_set_CanBePrefix (ndn_interest_t *interest, uint8_t can_be_prefix)
 Set CanBePrefix flag of the Interest. More...
 
static void ndn_interest_set_MustBeFresh (ndn_interest_t *interest, uint8_t must_be_fresh)
 Set MustBeFresh flag of the Interest. More...
 
static void ndn_interest_set_HopLimit (ndn_interest_t *interest, uint8_t hop)
 Set HopLimit element of the Interest. More...
 
static int ndn_interest_set_Parameters (ndn_interest_t *interest, const uint8_t *params_value, uint32_t params_size)
 Set Parameters element of the Interest. 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...
 

Typedef Documentation

◆ interest_params_t

The structure to represent the Interest parameters element.

◆ ndn_interest_t

typedef struct ndn_interest ndn_interest_t

The structure to represent an NDN Interest packet.

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_from_name()

static void ndn_interest_from_name ( ndn_interest_t interest,
const ndn_name_t name 
)
inlinestatic

Init an Interest packet from a.

Parameters
name.This function or ndn_interest_init() should be invoked whenever a new ndn_interest_t is created.
interest.Output. The Interest to be inited.
name.Input. The Interest name.

◆ ndn_interest_init()

static void ndn_interest_init ( ndn_interest_t interest)
inlinestatic

Init an Interest packet.

This function or ndn_interest_from_name() should be invoked whenever a new ndn_interest_t is created.

Parameters
interest.Output. The Interest to be inited.

◆ 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_set_CanBePrefix()

static void ndn_interest_set_CanBePrefix ( ndn_interest_t interest,
uint8_t  can_be_prefix 
)
inlinestatic

Set CanBePrefix flag of the Interest.

Parameters
interest.Output. The Interest whose flag will be set.
can_be_prefix.Input. CanBePrefix is set if can_be_prefix is larger than 0.

◆ ndn_interest_set_HopLimit()

static void ndn_interest_set_HopLimit ( ndn_interest_t interest,
uint8_t  hop 
)
inlinestatic

Set HopLimit element of the Interest.

Parameters
interest.Output. The Interest whose HopLimit will be set.
hop.Input. The value of the HopLimit.

◆ ndn_interest_set_MustBeFresh()

static void ndn_interest_set_MustBeFresh ( ndn_interest_t interest,
uint8_t  must_be_fresh 
)
inlinestatic

Set MustBeFresh flag of the Interest.

Parameters
interest.Output. The Interest whose flag will be set.
can_be_prefix.Input. MustBeFresh is set if must_be_fresh is larger than 0.

◆ ndn_interest_set_Parameters()

static int ndn_interest_set_Parameters ( ndn_interest_t interest,
const uint8_t *  params_value,
uint32_t  params_size 
)
inlinestatic

Set Parameters element of the Interest.

Parameters
interest.Output. The Interest whose Parameters will be set.
params_value.Input. The interest parameters value (V).
params_size.Input. The size of the interest parameters value (V).
Returns
0 if there is no error.

◆ 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.