ndn-lite
Data Structures | Typedefs | Functions
metainfo.h File Reference
#include "name.h"

Go to the source code of this file.

Data Structures

struct  ndn_metainfo
 The structure to represent the Metainfo structure. More...
 

Typedefs

typedef struct ndn_metainfo ndn_metainfo_t
 The structure to represent the Metainfo structure. More...
 

Functions

static void ndn_metainfo_init (ndn_metainfo_t *meta)
 Init a Metainfo structure. More...
 
static void ndn_metainfo_from_other (ndn_metainfo_t *meta, const ndn_metainfo_t *other)
 Init a Metainfo structure. More...
 
int ndn_metainfo_tlv_decode (ndn_decoder_t *decoder, ndn_metainfo_t *meta)
 Decode the Metainfo from wire format (TLV block). More...
 
int ndn_metainfo_from_tlv_block (ndn_metainfo_t *meta, const uint8_t *block_value, uint32_t block_size)
 Decode a Metainfo TLV block into a ndn_metainfo_t. More...
 
static void ndn_metainfo_set_content_type (ndn_metainfo_t *meta, uint8_t content_type)
 Set ContentType of the Metainfo. More...
 
static void ndn_metainfo_set_freshness_period (ndn_metainfo_t *meta, uint64_t freshness_period)
 Set FreshnessPeriod of the Metainfo. More...
 
static void ndn_metainfo_set_final_block_id (ndn_metainfo_t *meta, const name_component_t *final_block_id)
 Set FinalBlockId of the Metainfo. More...
 
static uint32_t ndn_metainfo_probe_block_size (const ndn_metainfo_t *meta)
 Probe the size of a Metainfo TLV block before encoding it from a Metainfo structure. More...
 
int ndn_metainfo_tlv_encode (ndn_encoder_t *encoder, const ndn_metainfo_t *meta)
 Encode the Metainfo structure into wire format (TLV block). More...
 

Typedef Documentation

◆ ndn_metainfo_t

typedef struct ndn_metainfo ndn_metainfo_t

The structure to represent the Metainfo structure.

Function Documentation

◆ ndn_metainfo_from_other()

static void ndn_metainfo_from_other ( ndn_metainfo_t meta,
const ndn_metainfo_t other 
)
inlinestatic

Init a Metainfo structure.

This function will do memory copy.

Parameters
meta.Output. The Metainfo structure to be inited.
other.Output. The Metainfo structure to be copied from.

◆ ndn_metainfo_from_tlv_block()

int ndn_metainfo_from_tlv_block ( ndn_metainfo_t meta,
const uint8_t *  block_value,
uint32_t  block_size 
)

Decode a Metainfo TLV block into a ndn_metainfo_t.

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

◆ ndn_metainfo_init()

static void ndn_metainfo_init ( ndn_metainfo_t meta)
inlinestatic

Init a Metainfo structure.

Parameters
meta.Output. The Metainfo structure to be inited.

◆ ndn_metainfo_probe_block_size()

static uint32_t ndn_metainfo_probe_block_size ( const ndn_metainfo_t meta)
inlinestatic

Probe the size of a Metainfo TLV block before encoding it from a Metainfo structure.

This function is used to check whether the output buffer size is enough or not.

Parameters
meta.Input. The Metainfo structure to probe.
Returns
the length of the Metainfo TLV block.

◆ ndn_metainfo_set_content_type()

static void ndn_metainfo_set_content_type ( ndn_metainfo_t meta,
uint8_t  content_type 
)
inlinestatic

Set ContentType of the Metainfo.

Parameters
meta.Output. The Metainfo whose ContentType will be set.
content_type.Input. ContentType value following NDN Packet Format Specification 0.3.

◆ ndn_metainfo_set_final_block_id()

static void ndn_metainfo_set_final_block_id ( ndn_metainfo_t meta,
const name_component_t final_block_id 
)
inlinestatic

Set FinalBlockId of the Metainfo.

Parameters
meta.Output. The Metainfo whose FinalBlockId will be set.
final_block_id.Input. The last component of Name.

◆ ndn_metainfo_set_freshness_period()

static void ndn_metainfo_set_freshness_period ( ndn_metainfo_t meta,
uint64_t  freshness_period 
)
inlinestatic

Set FreshnessPeriod of the Metainfo.

Parameters
meta.Output. The Metainfo whose FreshnessPeriod will be set.
freshness_period.Input. FreshnessPeriod value.

◆ ndn_metainfo_tlv_decode()

int ndn_metainfo_tlv_decode ( ndn_decoder_t decoder,
ndn_metainfo_t meta 
)

Decode the Metainfo from wire format (TLV block).

Parameters
decoder.Input. The decoder who keeps the decoding result and the state.
meta.Output. The Metainfo decoded from TLV block.
Returns
0 if there is no error.

◆ ndn_metainfo_tlv_encode()

int ndn_metainfo_tlv_encode ( ndn_encoder_t encoder,
const ndn_metainfo_t meta 
)

Encode the Metainfo structure into wire format (TLV block).

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