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_FULL(v)   (PG_PROTOCOL_MAJOR(v) * 10000 + PG_PROTOCOL_MINOR(v))
 
#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   "postgresql"
 
#define PG_ALPN_PROTOCOL_VECTOR   { 10, 'p','o','s','t','g','r','e','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 133 of file pqcomm.h.

◆ MAX_STARTUP_PACKET_LENGTH

#define MAX_STARTUP_PACKET_LENGTH   10000

Definition at line 119 of file pqcomm.h.

◆ NEGOTIATE_GSS_CODE

#define NEGOTIATE_GSS_CODE   PG_PROTOCOL(1234,5680)

Definition at line 168 of file pqcomm.h.

◆ NEGOTIATE_SSL_CODE

#define NEGOTIATE_SSL_CODE   PG_PROTOCOL(1234,5679)

Definition at line 167 of file pqcomm.h.

◆ PG_ALPN_PROTOCOL

#define PG_ALPN_PROTOCOL   "postgresql"

Definition at line 160 of file pqcomm.h.

◆ PG_ALPN_PROTOCOL_VECTOR

#define PG_ALPN_PROTOCOL_VECTOR   { 10, 'p','o','s','t','g','r','e','s','q','l' }

Definition at line 161 of file pqcomm.h.

◆ PG_PROTOCOL

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

Definition at line 90 of file pqcomm.h.

◆ PG_PROTOCOL_EARLIEST

#define PG_PROTOCOL_EARLIEST   PG_PROTOCOL(3,0)

Definition at line 97 of file pqcomm.h.

◆ PG_PROTOCOL_FULL

#define PG_PROTOCOL_FULL (   v)    (PG_PROTOCOL_MAJOR(v) * 10000 + PG_PROTOCOL_MINOR(v))

Definition at line 89 of file pqcomm.h.

◆ PG_PROTOCOL_LATEST

#define PG_PROTOCOL_LATEST   PG_PROTOCOL(3,0)

Definition at line 98 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:813
static int port
Definition: pg_regress.c:115
static const char * sockdir
Definition: pg_regress.c:128

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 122 of file pqcomm.h.

◆ CancelRequestPacket

◆ MsgType

Definition at line 102 of file pqcomm.h.

◆ PacketLen

typedef uint32 PacketLen

Definition at line 111 of file pqcomm.h.

◆ ProtocolVersion

Definition at line 100 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().