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

Macros

#define APPEND(ptr, extraLength)
 

Functions

 RTE_INIT (InitNullSig)
 
bool PData_Parse (PData *data, struct rte_mbuf *pkt, ParseFor parseFor)
 Parse Data. More...
 
DataSatisfyResult PData_CanSatisfy (PData *data, PInterest *interest)
 Determine whether Data can satisfy Interest. More...
 
struct rte_crypto_op * DataDigest_Prepare (CryptoQueuePair *cqp, Packet *npkt)
 Prepare a crypto_op for Data digest computation. More...
 
uint16_t DataDigest_Enqueue (CryptoQueuePair *cqp, struct rte_crypto_op **ops, uint16_t count)
 Enqueue crypto_ops for Data digest computation. More...
 
bool DataDigest_Finish (struct rte_crypto_op *op, Packet **npkt)
 Finish Data digest computation. More...
 
void DataEnc_PrepareMetaInfo (uint8_t *room, ContentType ct, uint32_t freshness, LName finalBlock)
 Prepare Data MetaInfo. More...
 
struct rte_mbuf * DataEnc_EncodeTpl (LName prefix, LName suffix, const uint8_t *meta, struct rte_mbuf *tplV, struct iovec *tplIov, int tplIovcnt, PacketMempools *mp, PacketTxAlign align)
 Encode Data with Content from template. More...
 
struct rte_mbuf * DataEnc_EncodeRoom (LName prefix, LName suffix, const uint8_t *meta, uint32_t roomL, struct iovec *roomIov, int *roomIovcnt, PacketMempools *mp, PacketTxAlign align)
 Encode Data with unfilled Content room. More...
 
PacketDataEnc_Sign (struct rte_mbuf *pkt, PacketMempools *mp, PacketTxAlign align)
 Append Null signature to Data. More...
 

Variables

uint8_t DataEnc_NoMetaInfo [] = {0}
 Indicate that Data MetaInfo field should be omitted. More...
 

Macro Definition Documentation

◆ APPEND

#define APPEND (   ptr,
  extraLength 
)
Value:
do { \
ptr = RTE_PTR_ADD(room, 2 + room[1]); \
room[1] += sizeof(*ptr) + (extraLength); \
} while (false)

Function Documentation

◆ DataDigest_Enqueue()

uint16_t DataDigest_Enqueue ( CryptoQueuePair cqp,
struct rte_crypto_op **  ops,
uint16_t  count 
)

Enqueue crypto_ops for Data digest computation.

Returns
number of rejected packets; they should be freed by caller.

◆ DataDigest_Finish()

bool DataDigest_Finish ( struct rte_crypto_op *  op,
Packet **  npkt 
)

Finish Data digest computation.

Parameters
opa dequeued crypto_op; will be freed.
[out]npktthe Data packet; DataDigest releases ownership.
Returns
whether success.

◆ DataDigest_Prepare()

struct rte_crypto_op* DataDigest_Prepare ( CryptoQueuePair cqp,
Packet npkt 
)

Prepare a crypto_op for Data digest computation.

Parameters
npktData packet.
Returns
rte_crypto_op placed in PData.helperScratch.

◆ DataEnc_EncodeRoom()

struct rte_mbuf* DataEnc_EncodeRoom ( LName  prefix,
LName  suffix,
const uint8_t *  meta,
uint32_t  roomL,
struct iovec *  roomIov,
int *  roomIovcnt,
PacketMempools mp,
PacketTxAlign  align 
)

Encode Data with unfilled Content room.

Parameters
prefixname prefix.
suffixname suffix.
metaprepared MetaInfo buffer.
roomLContent TLV-LENGTH.
[out]roomIovContent iov, must be filled/zeroed by caller.
[out]roomIovcntContent iov count.
Returns
encoded packet, or NULL upon failure.

◆ DataEnc_EncodeTpl()

struct rte_mbuf* DataEnc_EncodeTpl ( LName  prefix,
LName  suffix,
const uint8_t *  meta,
struct rte_mbuf *  tplV,
struct iovec *  tplIov,
int  tplIovcnt,
PacketMempools mp,
PacketTxAlign  align 
)

Encode Data with Content from template.

Parameters
prefixname prefix.
suffixname suffix.
metaprepared MetaInfo buffer.
tplVContent template.
tplIovContent iov, must match tplV .
Returns
encoded packet, or NULL upon failure.

◆ DataEnc_PrepareMetaInfo()

void DataEnc_PrepareMetaInfo ( uint8_t *  room,
ContentType  ct,
uint32_t  freshness,
LName  finalBlock 
)

Prepare Data MetaInfo.

Parameters
roomoutput buffer; must have enough capacity.
ctContentType numeric value.
freshnessFreshnessPeriod numeric value.
finalBlockFinalBlockId TLV-VALUE.
Postcondition
room contains MetaInfo TLV.

Required room capacity is the sum of:

  • MetaInfo TLV-TYPE and TLV-LENGTH, 2 octets
  • ContentType TLV, 3 octets.
  • FreshnessPeriod TLV, 6 octets.
  • FinalBlockId TLV, 2 octets + finalBlock.length .

◆ DataEnc_Sign()

Packet* DataEnc_Sign ( struct rte_mbuf *  pkt,
PacketMempools mp,
PacketTxAlign  align 
)

Append Null signature to Data.

Parameters
pktresult of DataEnc_EncodeTpl or DataEnc_EncodeRoom .
Returns
encoded packet, or NUL upon failure.
Postcondition
If failure, pkt is freed.

◆ PData_CanSatisfy()

DataSatisfyResult PData_CanSatisfy ( PData data,
PInterest interest 
)

Determine whether Data can satisfy Interest.

◆ PData_Parse()

bool PData_Parse ( PData data,
struct rte_mbuf *  pkt,
ParseFor  parseFor 
)

Parse Data.

Parameters
pkta uniquely owned, possibly segmented, direct mbuf that contains Data TLV.
parseForif set to ParseForFw , skip FinalBlock and set data->isFinalBlock to false.
Returns
whether success.

◆ RTE_INIT()

RTE_INIT ( InitNullSig  )

Variable Documentation

◆ DataEnc_NoMetaInfo

uint8_t DataEnc_NoMetaInfo[] = {0}

Indicate that Data MetaInfo field should be omitted.

◆ sigInfoTL

unaligned_uint16_t sigInfoTL

◆ sigTypeTL

unaligned_uint16_t sigTypeTL

◆ sigTypeV

uint8_t sigTypeV

◆ sigValueTL

unaligned_uint16_t sigValueTL