NDN-DPDK
High-Speed Named Data Networking Forwarder
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
lp.h
Go to the documentation of this file.
1 #ifndef NDNDPDK_NDNI_LP_H
2 #define NDNDPDK_NDNI_LP_H
3 
6 #include "common.h"
7 
9 typedef struct LpL2 {
10  uint64_t seqNumBase;
11  uint8_t fragIndex;
12  uint8_t fragCount;
13 
22  uint32_t reassBitmap;
23  struct cds_list_head reassNode;
25 } LpL2;
26 static_assert(LpMaxFragments <= UINT8_MAX, "");
27 static_assert(LpMaxFragments < CHAR_BIT * RTE_SIZEOF_FIELD(LpL2, reassBitmap), "");
28 
29 static __rte_always_inline uint64_t
30 LpL2_GetSeqNum(const LpL2* l2) {
31  return l2->seqNumBase + l2->fragIndex;
32 }
33 
35 typedef struct LpPitToken {
36  uint8_t length;
37  uint8_t value[32];
39 
41 __attribute__((nonnull)) static __rte_always_inline void
42 LpPitToken_Set(LpPitToken* token, uint8_t length, const uint8_t* value) {
43  token->length = length;
44  rte_memcpy(token->value, value, length);
45  memset(RTE_PTR_ADD(token->value, length), 0, sizeof(token->value) - length);
46 }
47 
52 __attribute__((nonnull, returns_nonnull)) const char*
53 LpPitToken_ToString(const LpPitToken* token);
54 
56 typedef struct LpL3 {
57  uint8_t nackReason;
58  uint8_t congMark;
60 } LpL3;
61 
63 typedef struct LpHeader {
67 
84 __attribute__((nonnull)) bool
85 LpHeader_Parse(LpHeader* lph, struct rte_mbuf* pkt);
86 
93 __attribute__((nonnull)) void
94 LpHeader_Prepend(struct rte_mbuf* pkt, const LpL3* l3, const LpL2* l2);
95 
96 #endif // NDNDPDK_NDN_LP_H
struct vlanhdr __rte_packed
struct LpPitToken LpPitToken
NDNLPv2 PIT token value.
bool LpHeader_Parse(LpHeader *lph, struct rte_mbuf *pkt)
Parse NDNLPv2 header and strip from mbuf.
Definition: lp.c:45
struct LpL3 LpL3
NDNLPv2 layer 3 fields.
const char * LpPitToken_ToString(const LpPitToken *token)
Print PIT token as string for logging.
Definition: lp.c:8
struct LpL2 LpL2
NDNLPv2 layer 2 fields and reassembler state.
struct LpHeader LpHeader
Parsed NDNLPv2 header.
void LpHeader_Prepend(struct rte_mbuf *pkt, const LpL3 *l3, const LpL2 *l2)
Prepend NDNLPv2 header to mbuf.
Definition: lp.c:144
struct Packet Packet
Definition: common.h:11
@ LpMaxFragments
Definition: enum.h:8
Parsed NDNLPv2 header.
Definition: lp.h:63
LpL2 l2
Definition: lp.h:65
LpL3 l3
Definition: lp.h:64
NDNLPv2 layer 2 fields and reassembler state.
Definition: lp.h:9
uint64_t seqNumBase
seqNum-fragIndex
Definition: lp.h:10
uint32_t reassBitmap
A bitmap of fragment arrival status.
Definition: lp.h:22
Packet * reassFrags[LpMaxFragments]
Definition: lp.h:24
struct cds_list_head reassNode
Definition: lp.h:23
uint8_t fragCount
Definition: lp.h:12
uint8_t fragIndex
Definition: lp.h:11
NDNLPv2 layer 3 fields.
Definition: lp.h:56
uint8_t nackReason
Definition: lp.h:57
LpPitToken pitToken
Definition: lp.h:59
uint8_t congMark
Definition: lp.h:58
NDNLPv2 PIT token value.
Definition: lp.h:35
uint8_t value[32]
Definition: lp.h:37
uint8_t length
Definition: lp.h:36