PcapPlusPlus  Next
pcpp::PostgresMessageType Class Reference

#include <PostgresLayer.h>

Public Types

enum  Value : uint8_t {
  Frontend_StartupMessage , Frontend_SSLRequest , Frontend_CancelRequest , Frontend_GSSENCRequest ,
  Frontend_Query , Frontend_Parse , Frontend_Bind , Frontend_Execute ,
  Frontend_Close , Frontend_Describe , Frontend_FunctionCall , Frontend_Flush ,
  Frontend_Sync , Frontend_CopyData , Frontend_CopyDone , Frontend_CopyFail ,
  Frontend_Terminate , Frontend_Unknown , Backend_AuthenticationOk , Backend_AuthenticationKerberosV4 ,
  Backend_AuthenticationKerberosV5 , Backend_AuthenticationCleartextPassword , Backend_AuthenticationMD5Password , Backend_AuthenticationGSS ,
  Backend_AuthenticationGSSContinue , Backend_AuthenticationSSPI , Backend_AuthenticationSASL , Backend_AuthenticationSASLContinue ,
  Backend_AuthenticationSASLFinal , Backend_BackendKeyData , Backend_BindComplete , Backend_CloseComplete ,
  Backend_CommandComplete , Backend_CopyData , Backend_CopyDone , Backend_CopyInResponse ,
  Backend_CopyOutResponse , Backend_CopyBothResponse , Backend_DataRow , Backend_EmptyQueryResponse ,
  Backend_ErrorResponse , Backend_FunctionCallResponse , Backend_NegotiateProtocolVersion , Backend_NoData ,
  Backend_NoticeResponse , Backend_NotificationResponse , Backend_ParameterDescription , Backend_ParameterStatus ,
  Backend_ParseComplete , Backend_PortalSuspended , Backend_ReadyForQuery , Backend_RowDescription ,
  Backend_Unknown
}
 Define enum types for all PostgreSQL message types. More...
 

Public Member Functions

constexpr PostgresMessageType (Value value)
 Constructs a PostgresMessageType object from a Value enum. More...
 
char toChar () const
 Converts the message type to its character representation. More...
 
std::string toString () const
 Returns a string representation of the message type. More...
 
 operator std::string () const
 Converts the message type to a string. More...
 
PostgresMessageOrigin getOrigin () const
 Returns the origin of the message (frontend or backend) More...
 

Friends

std::ostream & operator<< (std::ostream &os, const PostgresMessageType &messageType)
 Stream operator for PostgresMessageType. More...
 

Detailed Description

Represents PostgreSQL message types (both frontend and backend)

Member Enumeration Documentation

◆ Value

Define enum types for all PostgreSQL message types.

Enumerator
Frontend_StartupMessage 

Startup message (first message in connection)

Frontend_SSLRequest 

SSL request code (sent by client to request SSL)

Frontend_CancelRequest 

Cancel request (sent by client to cancel a running query)

Frontend_GSSENCRequest 

GSSAPI encryption request.

Frontend_Query 

Simple query message.

Frontend_Parse 

Parse message (prepared statement)

Frontend_Bind 

Bind message (portal binding)

Frontend_Execute 

Execute message (portal execution)

Frontend_Close 

Close message (close a prepared statement or portal)

Frontend_Describe 

Describe message (describe a prepared statement or portal)

Frontend_FunctionCall 

Function call message.

Frontend_Flush 

Flush message.

Frontend_Sync 

Sync message (sync after batch)

Frontend_CopyData 

Copy data message (during COPY)

Frontend_CopyDone 

Copy done message (during COPY)

Frontend_CopyFail 

Copy fail message (during COPY)

Frontend_Terminate 

Terminate message (disconnect)

Frontend_Unknown 

Unknown frontend message type.

Backend_AuthenticationOk 

Authentication successful.

Backend_AuthenticationKerberosV4 

Authentication using Kerberos V4.

Backend_AuthenticationKerberosV5 

Authentication using Kerberos V5.

Backend_AuthenticationCleartextPassword 

Authentication using cleartext password.

Backend_AuthenticationMD5Password 

Authentication using MD5 password.

Backend_AuthenticationGSS 

Authentication using GSSAPI.

Backend_AuthenticationGSSContinue 

GSSAPI authentication continues.

Backend_AuthenticationSSPI 

Authentication using SSPI.

Backend_AuthenticationSASL 

SASL authentication mechanism list.

Backend_AuthenticationSASLContinue 

SASL authentication continues.

Backend_AuthenticationSASLFinal 

SASL authentication final message.

Backend_BackendKeyData 

Backend key data (secret key for cancel)

Backend_BindComplete 

Bind complete.

Backend_CloseComplete 

Close complete.

Backend_CommandComplete 

Command complete (after query execution)

Backend_CopyData 

Copy data (during COPY)

Backend_CopyDone 

Copy done (during COPY)

Backend_CopyInResponse 

Copy in response (during COPY from client)

Backend_CopyOutResponse 

Copy out response (during COPY to client)

Backend_CopyBothResponse 

Copy both response (during COPY bidirectional)

Backend_DataRow 

Data row (result set)

Backend_EmptyQueryResponse 

Empty query response.

Backend_ErrorResponse 

Error response.

Backend_FunctionCallResponse 

Function call response.

Backend_NegotiateProtocolVersion 

Negotiate protocol version.

Backend_NoData 

No data (for queries that don't return rows)

Backend_NoticeResponse 

Notice response (warning)

Backend_NotificationResponse 

Notification response (LISTEN/NOTIFY)

Backend_ParameterDescription 

Parameter description (for prepared statements)

Backend_ParameterStatus 

Parameter status (runtime parameter setting)

Backend_ParseComplete 

Parse complete.

Backend_PortalSuspended 

Portal suspended (during cursor fetch)

Backend_ReadyForQuery 

Ready for query (idle state)

Backend_RowDescription 

Row description (column definitions)

Backend_Unknown 

Unknown backend message type.

Constructor & Destructor Documentation

◆ PostgresMessageType()

constexpr pcpp::PostgresMessageType::PostgresMessageType ( Value  value)
inlineconstexpr

Constructs a PostgresMessageType object from a Value enum.

Parameters
[in]valueThe Value enum value

Member Function Documentation

◆ getOrigin()

PostgresMessageOrigin pcpp::PostgresMessageType::getOrigin ( ) const

Returns the origin of the message (frontend or backend)

Returns
The message origin

◆ operator std::string()

pcpp::PostgresMessageType::operator std::string ( ) const
inlineexplicit

Converts the message type to a string.

Returns
The message type as a string

◆ toChar()

char pcpp::PostgresMessageType::toChar ( ) const

Converts the message type to its character representation.

Returns
The message type character

◆ toString()

std::string pcpp::PostgresMessageType::toString ( ) const

Returns a string representation of the message type.

Returns
A string representation of the message type

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const PostgresMessageType messageType 
)
friend

Stream operator for PostgresMessageType.

Parameters
[in]osThe output stream
[in]messageTypeThe message type to print
Returns
The output stream