NDN-DPDK
High-Speed Named Data Networking Forwarder
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Functions
tlv-decoder.c File Reference
#include "tlv-decoder.h"

Functions

void TlvDecoder_Truncate (TlvDecoder *d)
 Truncate mbuf to the remaining bytes. More...
 
void TlvDecoder_Copy_ (TlvDecoder *d, uint8_t *output, uint16_t count)
 
struct rte_mbuf * TlvDecoder_Clone (TlvDecoder *d, uint32_t count, struct rte_mempool *indirectMp)
 Clone next count octets to indirect mbufs. More...
 
void TlvDecoder_Fragment (TlvDecoder *d, uint32_t count, struct rte_mbuf *frames[], uint32_t *fragIndex, uint32_t fragCount, uint16_t fragSize, uint16_t headroom)
 Copy next count octets to fragments. More...
 
const uint8_t * TlvDecoder_Linearize_NonContiguous_ (TlvDecoder *d, uint16_t count)
 

Function Documentation

◆ TlvDecoder_Clone()

struct rte_mbuf* TlvDecoder_Clone ( TlvDecoder d,
uint32_t  count,
struct rte_mempool *  indirectMp 
)

Clone next count octets to indirect mbufs.

Returns
indirect mbufs.
Return values
NULLallocation failure.
Precondition
Decoder has no less than count remaining octets.
Postcondition
Decoder is advanced by count octets.

◆ TlvDecoder_Copy_()

void TlvDecoder_Copy_ ( TlvDecoder d,
uint8_t *  output,
uint16_t  count 
)

◆ TlvDecoder_Fragment()

void TlvDecoder_Fragment ( TlvDecoder d,
uint32_t  count,
struct rte_mbuf *  frames[],
uint32_t *  fragIndex,
uint32_t  fragCount,
uint16_t  fragSize,
uint16_t  headroom 
)

Copy next count octets to fragments.

Parameters
framesvector of fragments. They should not be chained.
[in,out]fragIndexpointer to first FragIndex, updated as last FragIndex.
fragCountcorrectly calculated FragCount.
fragSizemaximum fragment payload size.
headroomheadroom for subsequent fragments.
Precondition
Each segment has at least headroom+fragSize dataroom.
First fragment frames[*fragIndex] has initialized headroom and may contain payload.
Subsequent fragments are empty.
Postcondition
First fragment is appended up to headroom+fragSize offset.

◆ TlvDecoder_Linearize_NonContiguous_()

const uint8_t* TlvDecoder_Linearize_NonContiguous_ ( TlvDecoder d,
uint16_t  count 
)

◆ TlvDecoder_Truncate()

void TlvDecoder_Truncate ( TlvDecoder d)

Truncate mbuf to the remaining bytes.

Parameters
ddecoder. It shall have a uniquely owned, possibly segmented, direct mbuf. Its remaining length shall be non-zero.
Postcondition
d cannot be further used.