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

Go to the source code of this file.

Macros

#define TlvEncoder_ConstTL1(type, length)
 Encode constant TLV-TYPE and TLV-LENGTH to unaligned_uint16_t constant. More...
 
#define TlvEncoder_ConstTL3(type, length)
 Encode constant TLV-TYPE and TLV-LENGTH to unaligned_uint32_t constant. More...
 

Macro Definition Documentation

◆ TlvEncoder_ConstTL1

#define TlvEncoder_ConstTL1 (   type,
  length 
)
Value:
__extension__({ \
static_assert(__builtin_constant_p((type)), ""); \
static_assert(__builtin_constant_p((length)), ""); \
static_assert((type) < 0xFD, ""); \
static_assert((length) <= UINT8_MAX, ""); \
rte_cpu_to_be_16(((type) << 8) | (length)); \
})

Encode constant TLV-TYPE and TLV-LENGTH to unaligned_uint16_t constant.

Parameters
typeTLV-TYPE number, compile-time constant less than 0xFD.
lengthTLV-LENGTH number, compile-time constant no more than 0xFF.

◆ TlvEncoder_ConstTL3

#define TlvEncoder_ConstTL3 (   type,
  length 
)
Value:
__extension__({ \
static_assert(__builtin_constant_p((type)), ""); \
static_assert(__builtin_constant_p((length)), ""); \
static_assert(0xFD <= (type) && (type) <= UINT16_MAX, ""); \
static_assert((length) <= UINT8_MAX, ""); \
rte_cpu_to_be_32(0xFD000000 | ((type) << 8) | (length)); \
})

Encode constant TLV-TYPE and TLV-LENGTH to unaligned_uint32_t constant.

Parameters
typeTLV-TYPE number, compile-time constant between 0xFD and 0xFFFF.
lengthTLV-LENGTH number, compile-time constant no more than 0xFF.