Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
Loading...
Searching...
No Matches
duckdb::MainHeader Class Reference

Public Member Functions

string LibraryGitDesc ()
 
string LibraryGitHash ()
 
bool IsEncrypted () const
 
void SetEncrypted ()
 
void SetEncryptionVersion (uint8_t version)
 
void SetEncryptionMetadata (data_ptr_t source)
 
uint8_t GetEncryptionCipher () const
 
uint8_t GetEncryptionVersion () const
 
void SetDBIdentifier (data_ptr_t source)
 
void SetEncryptedCanary (data_ptr_t source)
 
void SetCanaryIV (data_ptr_t source)
 
void SetCanaryTag (data_ptr_t source)
 
data_ptr_t GetDBIdentifier ()
 
data_ptr_t GetIV ()
 
data_ptr_t GetTag ()
 
data_ptr_t GetEncryptedCanary ()
 
void Write (WriteStream &ser)
 

Static Public Member Functions

static void CheckMagicBytes (QueryContext context, FileHandle &handle)
 
static bool CompareDBIdentifiers (const data_ptr_t db_identifier_1, const data_ptr_t db_identifier_2)
 
static MainHeader Read (ReadStream &source)
 

Public Attributes

uint64_t version_number
 The (storage) version of the database.
 
uint64_t flags [FLAG_COUNT]
 The set of flags used by the database.
 
uint8_t encryption_version
 Encryption version.
 

Static Public Attributes

static constexpr idx_t MAX_VERSION_SIZE = 32
 
static constexpr idx_t MAGIC_BYTE_SIZE = 4
 
static constexpr idx_t MAGIC_BYTE_OFFSET = Storage::DEFAULT_BLOCK_HEADER_SIZE
 
static constexpr idx_t FLAG_COUNT = 4
 
static constexpr uint64_t ENCRYPTED_DATABASE_FLAG = 1
 Indicates whether database is encrypted or not.
 
static constexpr uint64_t DEFAULT_ENCRYPTION_KEY_LENGTH = 32
 The encryption key length.
 
static const char MAGIC_BYTES []
 The magic bytes in front of the file should be "DUCK".
 
static const char CANARY []
 The canary should be "DUCKKEY".
 
static constexpr idx_t DB_IDENTIFIER_LEN = 16
 The length of the unique database identifier.
 
static constexpr idx_t ENCRYPTION_METADATA_LEN = 8
 Optional metadata for encryption, if encryption flag is set.
 
static constexpr idx_t CANARY_BYTE_SIZE = 8
 The canary is a known plaintext for detecting wrong keys early.
 
static constexpr uint64_t AES_NONCE_LEN = 12
 Nonce, IV (nonce + counter) and tag length.
 
static constexpr uint64_t AES_COUNTER_BYTES = 4
 
static constexpr uint64_t AES_NONCE_LEN_DEPRECATED = 16
 
static constexpr uint64_t AES_IV_LEN = 16
 
static constexpr uint64_t AES_TAG_LEN = 16
 

Private Attributes

data_t library_git_desc [MAX_VERSION_SIZE]
 
data_t library_git_hash [MAX_VERSION_SIZE]
 
data_t encryption_metadata [ENCRYPTION_METADATA_LEN]
 
data_t db_identifier [DB_IDENTIFIER_LEN]
 The unique database identifier and optional encryption salt.
 
data_t encrypted_canary [CANARY_BYTE_SIZE]
 
data_t canary_iv [AES_NONCE_LEN]
 
data_t canary_tag [AES_TAG_LEN]
 

Detailed Description

The MainHeader is the first header in the storage file. It is written only once for a database file.

Member Function Documentation

◆ LibraryGitDesc()

string duckdb::MainHeader::LibraryGitDesc ( )
inline
9777 {
9778 return string(char_ptr_cast(library_git_desc), 0, MAX_VERSION_SIZE);
9779 }

◆ LibraryGitHash()

string duckdb::MainHeader::LibraryGitHash ( )
inline
9780 {
9781 return string(char_ptr_cast(library_git_hash), 0, MAX_VERSION_SIZE);
9782 }

◆ IsEncrypted()

bool duckdb::MainHeader::IsEncrypted ( ) const
inline
9784 {
9786 }
static constexpr uint64_t ENCRYPTED_DATABASE_FLAG
Indicates whether database is encrypted or not.
Definition duckdb.hpp:9747
uint64_t flags[FLAG_COUNT]
The set of flags used by the database.
Definition duckdb.hpp:9758

◆ SetEncrypted()

void duckdb::MainHeader::SetEncrypted ( )
inline
9787 {
9789 }

◆ SetEncryptionVersion()

void duckdb::MainHeader::SetEncryptionVersion ( uint8_t  version)
inline
9790 {
9791 encryption_version = version;
9792 }
uint8_t encryption_version
Encryption version.
Definition duckdb.hpp:9760

◆ SetEncryptionMetadata()

void duckdb::MainHeader::SetEncryptionMetadata ( data_ptr_t  source)
inline
9794 {
9795 memset(encryption_metadata, 0, ENCRYPTION_METADATA_LEN);
9796 memcpy(encryption_metadata, source, ENCRYPTION_METADATA_LEN);
9797 }
static constexpr idx_t ENCRYPTION_METADATA_LEN
Optional metadata for encryption, if encryption flag is set.
Definition duckdb.hpp:9765

◆ GetEncryptionCipher()

uint8_t duckdb::MainHeader::GetEncryptionCipher ( ) const
inline
9799 {
9800 return encryption_metadata[2];
9801 }

◆ GetEncryptionVersion()

uint8_t duckdb::MainHeader::GetEncryptionVersion ( ) const
inline
9803 {
9804 return encryption_metadata[3];
9805 }

◆ SetDBIdentifier()

void duckdb::MainHeader::SetDBIdentifier ( data_ptr_t  source)
inline
9807 {
9808 memset(db_identifier, 0, DB_IDENTIFIER_LEN);
9809 memcpy(db_identifier, source, DB_IDENTIFIER_LEN);
9810 }
data_t db_identifier[DB_IDENTIFIER_LEN]
The unique database identifier and optional encryption salt.
Definition duckdb.hpp:9860
static constexpr idx_t DB_IDENTIFIER_LEN
The length of the unique database identifier.
Definition duckdb.hpp:9763

◆ SetEncryptedCanary()

void duckdb::MainHeader::SetEncryptedCanary ( data_ptr_t  source)
inline
9812 {
9813 memset(encrypted_canary, 0, CANARY_BYTE_SIZE);
9814 memcpy(encrypted_canary, source, CANARY_BYTE_SIZE);
9815 }
static constexpr idx_t CANARY_BYTE_SIZE
The canary is a known plaintext for detecting wrong keys early.
Definition duckdb.hpp:9767

◆ SetCanaryIV()

void duckdb::MainHeader::SetCanaryIV ( data_ptr_t  source)
inline
9817 {
9818 memset(canary_iv, 0, AES_NONCE_LEN);
9819 memcpy(canary_iv, source, AES_NONCE_LEN);
9820 }
static constexpr uint64_t AES_NONCE_LEN
Nonce, IV (nonce + counter) and tag length.
Definition duckdb.hpp:9769

◆ SetCanaryTag()

void duckdb::MainHeader::SetCanaryTag ( data_ptr_t  source)
inline
9822 {
9823 memset(canary_tag, 0, AES_TAG_LEN);
9824 memcpy(canary_tag, source, AES_TAG_LEN);
9825 }

◆ GetDBIdentifier()

data_ptr_t duckdb::MainHeader::GetDBIdentifier ( )
inline
9827 {
9828 return db_identifier;
9829 }

◆ GetIV()

data_ptr_t duckdb::MainHeader::GetIV ( )
inline
9831 {
9832 return canary_iv;
9833 }

◆ GetTag()

data_ptr_t duckdb::MainHeader::GetTag ( )
inline
9835 {
9836 return canary_tag;
9837 }

◆ CompareDBIdentifiers()

static bool duckdb::MainHeader::CompareDBIdentifiers ( const data_ptr_t  db_identifier_1,
const data_ptr_t  db_identifier_2 
)
inlinestatic
9839 {
9840 for (idx_t i = 0; i < DB_IDENTIFIER_LEN; i++) {
9841 if (db_identifier_1[i] != db_identifier_2[i]) {
9842 return false;
9843 }
9844 }
9845 return true;
9846 }

◆ GetEncryptedCanary()

data_ptr_t duckdb::MainHeader::GetEncryptedCanary ( )
inline
9848 {
9849 return encrypted_canary;
9850 }

The documentation for this class was generated from the following file: