PcapPlusPlus  Next
pcpp::PostgresErrorResponseMessage Class Reference

#include <PostgresLayer.h>

Inheritance diagram for pcpp::PostgresErrorResponseMessage:
pcpp::PostgresMessage

Public Types

enum class  ErrorField : uint8_t {
  Severity = 'S' , SeverityNonLocalized = 'V' , SQLState = 'C' , Message = 'M' ,
  Detail = 'D' , Hint = 'H' , Position = 'P' , InternalPosition = 'p' ,
  InternalQuery = 'q' , Where = 'W' , Schema = 's' , Table = 't' ,
  Column = 'c' , DataType = 'd' , Constraint = 'n' , File = 'F' ,
  Line = 'L' , Routine = 'R' , Terminator = '\0'
}
 
using FieldMap = std::unordered_map< ErrorField, std::string >
 A map of error field type to value.
 

Public Member Functions

 PostgresErrorResponseMessage (const uint8_t *data, size_t dataLen)
 
const FieldMapgetFields () const
 
- Public Member Functions inherited from pcpp::PostgresMessage
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...
 

Additional Inherited Members

- Static Public Member Functions inherited from pcpp::PostgresMessage
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 ErrorResponse or NoticeResponse message (backend)

Member Enumeration Documentation

◆ ErrorField

Represents the field types in a PostgreSQL ErrorResponse or NoticeResponse message

Enumerator
Severity 

Severity: the field contents are ERROR, FATAL, or PANIC (localized)

SeverityNonLocalized 

Severity: the field contents are ERROR, FATAL, PANIC or DEBUG, LOG, INFO, NOTICE, WARNING, or DEBUG (non-localized)

SQLState 

SQLSTATE code.

Message 

Primary human-readable error message.

Detail 

Optional secondary error message.

Hint 

Optional hint.

Position 

Decimal integer indicating an error cursor position.

InternalPosition 

Internal cursor position (where error occurred)

InternalQuery 

Text of internal query.

Where 

Indicating context of error.

Schema 

Schema name.

Table 

Table name.

Column 

Column name.

DataType 

Data type name.

Constraint 

Constraint name.

File 

File name of error.

Line 

Line number of error.

Routine 

Routine name.

Terminator 

Terminator (always '\0')

Constructor & Destructor Documentation

◆ PostgresErrorResponseMessage()

pcpp::PostgresErrorResponseMessage::PostgresErrorResponseMessage ( const uint8_t *  data,
size_t  dataLen 
)
inline

A constructor that creates the layer from an existing packet raw data

Parameters
[in]dataA pointer to the raw data
[in]dataLenSize of the data in bytes

Member Function Documentation

◆ getFields()

const FieldMap& pcpp::PostgresErrorResponseMessage::getFields ( ) const
Returns
The error fields as a map