rlp/constants.hpp¶
Namespaces¶
| Name |
|---|
| rlp |
Classes¶
| Name | |
|---|---|
| struct | rlp::Header |
Types¶
| Name | |
|---|---|
| enum class | Leftover |
Attributes¶
| Name | |
|---|---|
| uint8_t | kEmptyStringCode |
| uint8_t | kEmptyListCode |
| uint8_t | kMaxShortStringLen |
| uint8_t | kMaxShortListLen |
| uint8_t | kShortStringOffset |
| uint8_t | kLongStringOffset |
| uint8_t | kShortListOffset |
| uint8_t | kLongListOffset |
| uint8_t | kRlpSingleByteThreshold |
| size_t | kLongPrefixByteSize Size of the single prefix byte prepended before the big-endian length field in long strings/lists. |
| size_t | kSingleByteStringSize Minimum encoded size of a single-byte RLP string (prefix byte + payload byte). |
Types Documentation¶
enum Leftover¶
| Enumerator | Value | Description |
|---|---|---|
| kProhibit | ||
| kAllow |
Attributes Documentation¶
variable kEmptyStringCode¶
variable kEmptyListCode¶
variable kMaxShortStringLen¶
variable kMaxShortListLen¶
variable kShortStringOffset¶
variable kLongStringOffset¶
variable kShortListOffset¶
variable kLongListOffset¶
variable kRlpSingleByteThreshold¶
variable kLongPrefixByteSize¶
Size of the single prefix byte prepended before the big-endian length field in long strings/lists.
variable kSingleByteStringSize¶
Minimum encoded size of a single-byte RLP string (prefix byte + payload byte).
Source code¶
#ifndef RLP_CONSTANTS_HPP
#define RLP_CONSTANTS_HPP
#include <cstdint>
namespace rlp {
// RLP encoding constants
inline constexpr uint8_t kEmptyStringCode{0x80};
inline constexpr uint8_t kEmptyListCode{0xC0};
inline constexpr uint8_t kMaxShortStringLen{55}; // 0xB7 - 0x80
inline constexpr uint8_t kMaxShortListLen{55}; // 0xF7 - 0xC0
inline constexpr uint8_t kShortStringOffset{0x80};
inline constexpr uint8_t kLongStringOffset{0xB7}; // 0x80 + 55 + 1
inline constexpr uint8_t kShortListOffset{0xC0};
inline constexpr uint8_t kLongListOffset{0xF7}; // 0xC0 + 55 + 1
inline constexpr uint8_t kRlpSingleByteThreshold{0x80}; // Values below this are encoded as a single byte
inline constexpr size_t kLongPrefixByteSize{1};
inline constexpr size_t kSingleByteStringSize{2};
// RLP header structure (internal use)
struct Header {
bool list{false};
size_t payload_size_bytes{0}; // Size of payload in bytes (not item count for lists)
size_t header_size_bytes{0}; // Size of the RLP header/prefix itself in bytes
};
// Leftover handling mode for decoding
enum class Leftover {
kProhibit,
kAllow,
};
} // namespace rlp
#endif // RLP_CONSTANTS_HPP
Updated on 2026-04-13 at 23:22:46 -0700