PostgreSQL Source Code  git master
pqcomm.h File Reference
#include <sys/socket.h>
#include <sys/un.h>
#include <netdb.h>
#include <netinet/in.h>
#include "libpq/protocol.h"
Include dependency graph for pqcomm.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  SockAddr
 
struct  AddrInfo
 
struct  CancelRequestPacket
 

Macros

#define UNIXSOCK_PATH(path, port, sockdir)
 
#define UNIXSOCK_PATH_BUFLEN   sizeof(((struct sockaddr_un *) NULL)->sun_path)
 
#define PG_PROTOCOL_MAJOR(v)   ((v) >> 16)
 
#define PG_PROTOCOL_MINOR(v)   ((v) & 0x0000ffff)
 
#define PG_PROTOCOL(m, n)   (((m) << 16) | (n))
 
#define PG_PROTOCOL_EARLIEST   PG_PROTOCOL(3,0)
 
#define PG_PROTOCOL_LATEST   PG_PROTOCOL(3,0)
 
#define MAX_STARTUP_PACKET_LENGTH   10000
 
#define CANCEL_REQUEST_CODE   PG_PROTOCOL(1234,5678)
 
#define PG_ALPN_PROTOCOL   "TBD-pgsql"
 
#define PG_ALPN_PROTOCOL_VECTOR   { 9, 'T','B','D','-','p','g','s','q','l' }
 
#define NEGOTIATE_SSL_CODE   PG_PROTOCOL(1234,5679)
 
#define NEGOTIATE_GSS_CODE   PG_PROTOCOL(1234,5680)
 

Typedefs

typedef uint32 ProtocolVersion
 
typedef ProtocolVersion MsgType
 
typedef uint32 PacketLen
 
typedef uint32 AuthRequest
 
typedef struct CancelRequestPacket CancelRequestPacket
 

Functions

static bool is_unixsock_path (const char *path)
 

Macro Definition Documentation

◆ CANCEL_REQUEST_CODE

#define CANCEL_REQUEST_CODE   PG_PROTOCOL(1234,5678)

Definition at line 132 of file pqcomm.h.

◆ MAX_STARTUP_PACKET_LENGTH

#define MAX_STARTUP_PACKET_LENGTH   10000

Definition at line 118 of file pqcomm.h.

◆ NEGOTIATE_GSS_CODE

#define NEGOTIATE_GSS_CODE   PG_PROTOCOL(1234,5680)

Definition at line 167 of file pqcomm.h.

◆ NEGOTIATE_SSL_CODE

#define NEGOTIATE_SSL_CODE   PG_PROTOCOL(1234,5679)

Definition at line 166 of file pqcomm.h.

◆ PG_ALPN_PROTOCOL

#define PG_ALPN_PROTOCOL   "TBD-pgsql"

Definition at line 159 of file pqcomm.h.

◆ PG_ALPN_PROTOCOL_VECTOR

#define PG_ALPN_PROTOCOL_VECTOR   { 9, 'T','B','D','-','p','g','s','q','l' }

Definition at line 160 of file pqcomm.h.

◆ PG_PROTOCOL

#define PG_PROTOCOL (   m,
 
)    (((m) << 16) | (n))

Definition at line 89 of file pqcomm.h.

◆ PG_PROTOCOL_EARLIEST

#define PG_PROTOCOL_EARLIEST   PG_PROTOCOL(3,0)

Definition at line 96 of file pqcomm.h.

◆ PG_PROTOCOL_LATEST

#define PG_PROTOCOL_LATEST   PG_PROTOCOL(3,0)

Definition at line 97 of file pqcomm.h.

◆ PG_PROTOCOL_MAJOR

#define PG_PROTOCOL_MAJOR (   v)    ((v) >> 16)

Definition at line 87 of file pqcomm.h.

◆ PG_PROTOCOL_MINOR

#define PG_PROTOCOL_MINOR (   v)    ((v) & 0x0000ffff)

Definition at line 88 of file pqcomm.h.

◆ UNIXSOCK_PATH

#define UNIXSOCK_PATH (   path,
  port,
  sockdir 
)
Value:
AssertMacro(*(sockdir) != '\0'), \
snprintf(path, sizeof(path), "%s/.s.PGSQL.%d", \
(sockdir), (port)))
#define AssertMacro(condition)
Definition: c.h:859
static int port
Definition: pg_regress.c:116
static const char * sockdir
Definition: pg_regress.c:129

Definition at line 44 of file pqcomm.h.

◆ UNIXSOCK_PATH_BUFLEN

#define UNIXSOCK_PATH_BUFLEN   sizeof(((struct sockaddr_un *) NULL)->sun_path)

Definition at line 60 of file pqcomm.h.

Typedef Documentation

◆ AuthRequest

Definition at line 121 of file pqcomm.h.

◆ CancelRequestPacket

◆ MsgType

Definition at line 101 of file pqcomm.h.

◆ PacketLen

typedef uint32 PacketLen

Definition at line 110 of file pqcomm.h.

◆ ProtocolVersion

Definition at line 99 of file pqcomm.h.

Function Documentation

◆ is_unixsock_path()

static bool is_unixsock_path ( const char *  path)
inlinestatic

Definition at line 67 of file pqcomm.h.

68 {
69  return is_absolute_path(path) || path[0] == '@';
70 }
#define is_absolute_path(filename)
Definition: port.h:103

References is_absolute_path.

Referenced by check_pghost_envvar(), do_connect(), exec_command_conninfo(), get_prompt(), passwordFromFile(), and pqConnectOptions2().