Go to the source code of this file.
|
#define | TlvDecoder_EachTL(d, typeVar, lengthVar) |
| Iterate over TLV elements. More...
|
|
#define | TlvDecoder_ReadNniToTypeMax_(sizeofValue) |
|
#define | TlvDecoder_ReadNniTo4_(d, length, max, ptr) |
|
#define | TlvDecoder_ReadNniTo3_(d, length, ptr) TlvDecoder_ReadNniTo4_((d), (length), UINT64_MAX, (ptr)) |
|
#define | TlvDecoder_ReadNniToArg5_(a1, a2, a3, a4, a5, ...) a5 |
|
#define | TlvDecoder_ReadNniToChoose_(...) TlvDecoder_ReadNniToArg5_(__VA_ARGS__, TlvDecoder_ReadNniTo4_, TlvDecoder_ReadNniTo3_, ) |
|
#define | TlvDecoder_ReadNniTo(...) (TlvDecoder_ReadNniToChoose_(__VA_ARGS__)(__VA_ARGS__)) |
| Read non-negative integer to a pointer of any unsigned type. More...
|
|
|
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) |
|
◆ TlvDecoder_EachTL
#define TlvDecoder_EachTL |
( |
|
d, |
|
|
|
typeVar, |
|
|
|
lengthVar |
|
) |
| |
Value: for (uint32_t lengthVar, typeVar = TlvDecoder_ReadTL((d), &lengthVar); typeVar != 0; \
typeVar = TlvDecoder_ReadTL((d), &lengthVar))
Iterate over TLV elements.
TlvDecoder_Skip(&decoder, length);
}
#define TlvDecoder_EachTL(d, typeVar, lengthVar)
Iterate over TLV elements.
Definition: tlv-decoder.h:257
◆ TlvDecoder_ReadNniTo
Read non-negative integer to a pointer of any unsigned type.
#define TlvDecoder_ReadNniTo(...)
Read non-negative integer to a pointer of any unsigned type.
Definition: tlv-decoder.h:321
- Returns
- whether success.
- Postcondition
- Decoder is advanced after the number.
◆ TlvDecoder_ReadNniTo3_
◆ TlvDecoder_ReadNniTo4_
#define TlvDecoder_ReadNniTo4_ |
( |
|
d, |
|
|
|
length, |
|
|
|
max, |
|
|
|
ptr |
|
) |
| |
Value: __extension__({ \
uint64_t value; \
bool ok = TlvDecoder_ReadNni( \
*(ptr) = value; \
ok; \
})
#define TlvDecoder_ReadNniToTypeMax_(sizeofValue)
Definition: tlv-decoder.h:289
◆ TlvDecoder_ReadNniToArg5_
#define TlvDecoder_ReadNniToArg5_ |
( |
|
a1, |
|
|
|
a2, |
|
|
|
a3, |
|
|
|
a4, |
|
|
|
a5, |
|
|
|
... |
|
) |
| a5 |
◆ TlvDecoder_ReadNniToChoose_
◆ TlvDecoder_ReadNniToTypeMax_
#define TlvDecoder_ReadNniToTypeMax_ |
( |
|
sizeofValue | ) |
|
Value: (sizeofValue) == sizeof(uint8_t) ? UINT8_MAX \
: (sizeofValue) == sizeof(uint16_t) ? UINT16_MAX \
: (sizeofValue) == sizeof(uint32_t) ? UINT32_MAX \
: (sizeofValue) == sizeof(uint64_t) ? UINT64_MAX \
: 0
◆ TlvDecoder
◆ 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
-
- 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
-
| frames | vector of fragments. They should not be chained. |
[in,out] | fragIndex | pointer to first FragIndex, updated as last FragIndex. |
| fragCount | correctly calculated FragCount. |
| fragSize | maximum fragment payload size. |
| headroom | headroom 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()
Truncate mbuf to the remaining bytes.
- Parameters
-
d | decoder. It shall have a uniquely owned, possibly segmented, direct mbuf. Its remaining length shall be non-zero. |
- Postcondition
d
cannot be further used.