Database System 0.1.0
Advanced C++20 Database System with Multi-Backend Support
Loading...
Searching...
No Matches
database::protocol::message_header Struct Reference

Common header for all protocol messages. More...

#include <database_protocol.h>

Collaboration diagram for database::protocol::message_header:
Collaboration graph

Public Member Functions

bool is_valid () const
 Validate message header.
 

Public Attributes

uint32_t magic = MAGIC
 
uint16_t version = PROTOCOL_VERSION
 
message_type type
 
uint64_t request_id
 
uint32_t payload_size
 

Static Public Attributes

static constexpr uint32_t MAGIC = 0xDB01DB01
 
static constexpr uint16_t PROTOCOL_VERSION = 1
 

Detailed Description

Common header for all protocol messages.

Binary layout (12 bytes):

  • magic: 4 bytes (0xDB01DB01)
  • version: 2 bytes (1)
  • type: 2 bytes
  • request_id: 8 bytes
  • payload_size: 4 bytes

Definition at line 78 of file database_protocol.h.

Member Function Documentation

◆ is_valid()

bool database::protocol::message_header::is_valid ( ) const
inlinenodiscard

Validate message header.

Returns
true if valid, false otherwise

Definition at line 92 of file database_protocol.h.

References MAGIC, magic, PROTOCOL_VERSION, and version.

Referenced by database::protocol::protocol_serializer::deserialize_header(), TEST_F(), TEST_F(), and TEST_F().

Here is the caller graph for this function:

Member Data Documentation

◆ MAGIC

uint32_t database::protocol::message_header::MAGIC = 0xDB01DB01
staticconstexpr

Definition at line 79 of file database_protocol.h.

Referenced by is_valid(), and TEST_F().

◆ magic

◆ payload_size

uint32_t database::protocol::message_header::payload_size

◆ PROTOCOL_VERSION

uint16_t database::protocol::message_header::PROTOCOL_VERSION = 1
staticconstexpr

Definition at line 80 of file database_protocol.h.

Referenced by is_valid(), and TEST_F().

◆ request_id

uint64_t database::protocol::message_header::request_id

◆ type

◆ version


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