xale-db 1.0
minimal SQL engine, written in c++
Loading...
Searching...
No Matches
Xale::Net::Packet Class Reference

Represents a network packet for communication in Xale DB. More...

#include <Packet.h>

Inheritance diagram for Xale::Net::Packet:
Inheritance graph
Collaboration diagram for Xale::Net::Packet:
Collaboration graph

Public Member Functions

 Packet (CommandType cmd, std::vector< uint8_t > data, std::vector< uint8_t > tokenData={})
 Constructs a Packet with command, payload, and optional token.
std::vector< uint8_t > serialize () const override
 Serializes the packet to a byte vector.
void deserialize (const std::vector< uint8_t > &buffer) override
 Deserializes the packet from a byte vector.
uint32_t size () const override
 Gets the total size of the packet in bytes.
const std::vector< uint8_t > getPayload () const
 Gets the payload data of the packet.
Public Member Functions inherited from Xale::Net::IPacket
virtual ~IPacket ()=default

Detailed Description

Represents a network packet for communication in Xale DB.

Constructor & Destructor Documentation

◆ Packet()

Xale::Net::Packet::Packet ( CommandType cmd,
std::vector< uint8_t > data,
std::vector< uint8_t > tokenData = {} )

Constructs a Packet with command, payload, and optional token.

Constructs a Packet with command, payload, and optional token (token ignored for now).

Parameters
cmdCommand type
dataPayload data
tokenDataOptional authentication token
cmdCommand type
dataPayload data
tokenDataOptional authentication token (ignored)

Member Function Documentation

◆ deserialize()

void Xale::Net::Packet::deserialize ( const std::vector< uint8_t > & buffer)
overridevirtual

Deserializes the packet from a byte vector.

Deserializes the packet from a byte vector (no token support for now).

Parameters
bufferByte vector containing serialized packet

Implements Xale::Net::IPacket.

◆ getPayload()

const std::vector< uint8_t > Xale::Net::Packet::getPayload ( ) const

Gets the payload data of the packet.

Returns
Payload as vector of bytes

◆ serialize()

std::vector< uint8_t > Xale::Net::Packet::serialize ( ) const
overridevirtual

Serializes the packet to a byte vector.

Serializes the packet to a byte vector (no token support for now).

Returns
Serialized packet as vector of bytes

Implements Xale::Net::IPacket.

◆ size()

uint32_t Xale::Net::Packet::size ( ) const
overridevirtual

Gets the total size of the packet in bytes.

Gets the total size of the packet in bytes (no token).

Returns
Size of the packet

Implements Xale::Net::IPacket.


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