digoal
2023-08-24
PostgreSQL , PolarDB , protocol , head
Introduce macros for protocol characters.
author Nathan Bossart <nathan@postgresql.org>
Wed, 23 Aug 2023 02:16:12 +0000 (19:16 -0700)
committer Nathan Bossart <nathan@postgresql.org>
Wed, 23 Aug 2023 02:16:12 +0000 (19:16 -0700)
commit f4b54e1ed9853ab9aff524494866823f951b1e7f
tree d828a0aceba5a1e74372170b58c97bae56eeefa3 tree
parent 711479115836b2180f50c00bbf0773220848a7f5 commit | diff
Introduce macros for protocol characters.
This commit introduces descriptively-named macros for the
identifiers used in wire protocol messages. These new macros are
placed in a new header file so that they can be easily used by
third-party code.
Author: Dave Cramer
Reviewed-by: Alvaro Herrera, Tatsuo Ishii, Peter Smith, Robert Haas, Tom Lane, Peter Eisentraut, Michael Paquier
Discussion: https://postgr.es/m/CADK3HHKbBmK-PKf1bPNFoMC%2BoBt%2BpD9PH8h5nvmBQskEHm-Ehw%40mail.gmail.com
1 /*-------------------------------------------------------------------------
2 *
3 * protocol.h
4 * Definitions of the request/response codes for the wire protocol.
5 *
6 *
7 * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
9 *
10 * src/include/libpq/protocol.h
11 *
12 *-------------------------------------------------------------------------
13 */
14 #ifndef PROTOCOL_H
15 #define PROTOCOL_H
16
17 /* These are the request codes sent by the frontend. */
18
19 #define PqMsg_Bind 'B'
20 #define PqMsg_Close 'C'
21 #define PqMsg_Describe 'D'
22 #define PqMsg_Execute 'E'
23 #define PqMsg_FunctionCall 'F'
24 #define PqMsg_Flush 'H'
25 #define PqMsg_Parse 'P'
26 #define PqMsg_Query 'Q'
27 #define PqMsg_Sync 'S'
28 #define PqMsg_Terminate 'X'
29 #define PqMsg_CopyFail 'f'
30 #define PqMsg_GSSResponse 'p'
31 #define PqMsg_PasswordMessage 'p'
32 #define PqMsg_SASLInitialResponse 'p'
33 #define PqMsg_SASLResponse 'p'
34
35
36 /* These are the response codes sent by the backend. */
37
38 #define PqMsg_ParseComplete '1'
39 #define PqMsg_BindComplete '2'
40 #define PqMsg_CloseComplete '3'
41 #define PqMsg_NotificationResponse 'A'
42 #define PqMsg_CommandComplete 'C'
43 #define PqMsg_DataRow 'D'
44 #define PqMsg_ErrorResponse 'E'
45 #define PqMsg_CopyInResponse 'G'
46 #define PqMsg_CopyOutResponse 'H'
47 #define PqMsg_EmptyQueryResponse 'I'
48 #define PqMsg_BackendKeyData 'K'
49 #define PqMsg_NoticeResponse 'N'
50 #define PqMsg_AuthenticationRequest 'R'
51 #define PqMsg_ParameterStatus 'S'
52 #define PqMsg_RowDescription 'T'
53 #define PqMsg_FunctionCallResponse 'V'
54 #define PqMsg_CopyBothResponse 'W'
55 #define PqMsg_ReadyForQuery 'Z'
56 #define PqMsg_NoData 'n'
57 #define PqMsg_PortalSuspended 's'
58 #define PqMsg_ParameterDescription 't'
59 #define PqMsg_NegotiateProtocolVersion 'v'
60
61
62 /* These are the codes sent by both the frontend and backend. */
63
64 #define PqMsg_CopyDone 'c'
65 #define PqMsg_CopyData 'd'
66
67
68 /* These are the authentication request codes sent by the backend. */
69
70 #define AUTH_REQ_OK 0 /* User is authenticated */
71 #define AUTH_REQ_KRB4 1 /* Kerberos V4. Not supported any more. */
72 #define AUTH_REQ_KRB5 2 /* Kerberos V5. Not supported any more. */
73 #define AUTH_REQ_PASSWORD 3 /* Password */
74 #define AUTH_REQ_CRYPT 4 /* crypt password. Not supported any more. */
75 #define AUTH_REQ_MD5 5 /* md5 password */
76 /* 6 is available. It was used for SCM creds, not supported any more. */
77 #define AUTH_REQ_GSS 7 /* GSSAPI without wrap() */
78 #define AUTH_REQ_GSS_CONT 8 /* Continue GSS exchanges */
79 #define AUTH_REQ_SSPI 9 /* SSPI negotiate without wrap() */
80 #define AUTH_REQ_SASL 10 /* Begin SASL authentication */
81 #define AUTH_REQ_SASL_CONT 11 /* Continue SASL authentication */
82 #define AUTH_REQ_SASL_FIN 12 /* Final SASL message */
83 #define AUTH_REQ_MAX AUTH_REQ_SASL_FIN /* maximum AUTH_REQ_* value */
84
85 #endif /* PROTOCOL_H */