PcapPlusPlus  Next
pcpp::PostgresMessage Class Reference

#include <PostgresLayer.h>

Inheritance diagram for pcpp::PostgresMessage:
pcpp::PostgresDataRowMessage pcpp::PostgresErrorResponseMessage pcpp::PostgresParameterStatus pcpp::PostgresQueryMessage pcpp::PostgresRowDescriptionMessage pcpp::PostgresStartupMessage

Public Member Functions

PostgresMessageType getMessageType () const
 
PostgresMessageOrigin getMessageOrigin () const
 
uint32_t getMessageLength () const
 Returns the length of the message payload. More...
 
size_t getTotalMessageLength () const
 Returns the total length of the message including the length field. More...
 
std::vector< uint8_t > getRawPayload () const
 Returns the raw payload bytes of the message. More...
 

Static Public Member Functions

static std::unique_ptr< PostgresMessageparsePostgresBackendMessage (const uint8_t *data, size_t dataLen)
 Parse a PostgreSQL backend message from raw data. More...
 
static std::unique_ptr< PostgresMessageparsePostgresFrontendMessage (const uint8_t *data, size_t dataLen)
 Parse a PostgreSQL frontend message from raw data. More...
 

Detailed Description

Represents a PostgreSQL message (base class)

Member Function Documentation

◆ getMessageLength()

uint32_t pcpp::PostgresMessage::getMessageLength ( ) const

Returns the length of the message payload.

Returns
The message length. If the first byte the message starts is 0, with length (no message type)

◆ getMessageOrigin()

PostgresMessageOrigin pcpp::PostgresMessage::getMessageOrigin ( ) const
inline
Returns
The message origin (frontend or backend)

◆ getMessageType()

PostgresMessageType pcpp::PostgresMessage::getMessageType ( ) const
inline
Returns
The message type

◆ getRawPayload()

std::vector<uint8_t> pcpp::PostgresMessage::getRawPayload ( ) const

Returns the raw payload bytes of the message.

Returns
The raw payload bytes of the message

◆ getTotalMessageLength()

size_t pcpp::PostgresMessage::getTotalMessageLength ( ) const
inline

Returns the total length of the message including the length field.

Returns
The total message length in bytes

◆ parsePostgresBackendMessage()

static std::unique_ptr<PostgresMessage> pcpp::PostgresMessage::parsePostgresBackendMessage ( const uint8_t *  data,
size_t  dataLen 
)
static

Parse a PostgreSQL backend message from raw data.

Parameters
[in]dataA pointer to the raw data
[in]dataLenSize of the data in bytes
Returns
A unique pointer to the parsed PostgresMessage, or nullptr if parsing fails

◆ parsePostgresFrontendMessage()

static std::unique_ptr<PostgresMessage> pcpp::PostgresMessage::parsePostgresFrontendMessage ( const uint8_t *  data,
size_t  dataLen 
)
static

Parse a PostgreSQL frontend message from raw data.

Parameters
[in]dataA pointer to the raw data
[in]dataLenSize of the data in bytes
Returns
A unique pointer to the parsed PostgresMessage, or nullptr if parsing fails