2323#define INCLUDED_CDB2API_HNDL_H
2424#include <sbuf2.h>
2525
26- #define MAX_NODES 128
26+ #define MAX_NODES 48
2727
28- #define DBNAME_LEN 64
29- #define TYPE_LEN 64
28+ #define DBNAME_LEN 32
29+ #define TYPE_LEN 32
3030#define POLICY_LEN 24
3131
32- #define CDB2HOSTNAME_LEN 128
32+ #define CDB2HOSTNAME_LEN 64
3333
3434#define MAX_STACK 512 /* Size of call-stack which opened the handle */
3535
@@ -103,9 +103,11 @@ struct cdb2_ssl_sess {
103103};
104104typedef struct cdb2_ssl_sess cdb2_ssl_sess ;
105105
106+ #define TYPESTR_LEN 64
107+
106108struct cdb2_hndl {
107109 char dbname [DBNAME_LEN ];
108- char cluster [64 ];
110+ char cluster [32 ];
109111 char type [TYPE_LEN ];
110112 char hosts [MAX_NODES ][CDB2HOSTNAME_LEN ];
111113 uint64_t timestampus ; // client query timestamp of first try
@@ -115,6 +117,9 @@ struct cdb2_hndl {
115117 char cached_host [CDB2HOSTNAME_LEN ]; /* hostname of a sockpool connection */
116118 int cached_port ; /* port of a sockpool connection */
117119 SBUF2 * sb ;
120+ int num_set_commands ;
121+ int num_set_commands_sent ;
122+ char * * commands ;
118123 int dbnum ;
119124 int num_hosts ; /* total number of hosts */
120125 int num_hosts_sameroom ; /* number of hosts that are in my datacenter (aka room) */
@@ -126,7 +131,7 @@ struct cdb2_hndl {
126131 int is_retry ;
127132 int is_chunk ;
128133 int is_set ;
129- char newsql_typestr [DBNAME_LEN + TYPE_LEN + POLICY_LEN + 16 ];
134+ char newsql_typestr [TYPESTR_LEN ];
130135 char policy [POLICY_LEN ];
131136 int master ;
132137 int connected_host ;
@@ -140,9 +145,9 @@ struct cdb2_hndl {
140145 char * sql ;
141146 int ntypes ;
142147 int * types ;
143- uint8_t * last_buf ;
148+ unsigned char * last_buf ;
144149 CDB2SQLRESPONSE * lastresponse ;
145- uint8_t * first_buf ;
150+ unsigned char * first_buf ;
146151 CDB2SQLRESPONSE * firstresponse ;
147152 int error_in_trans ;
148153 int client_side_error ;
@@ -153,47 +158,65 @@ struct cdb2_hndl {
153158 int snapshot_offset ;
154159 int query_no ;
155160 int retry_all ;
156- int num_set_commands ;
157- int num_set_commands_sent ;
158161 int is_read ;
159162 unsigned long long rows_read ;
160163 int read_intrans_results ;
161164 int first_record_read ;
162- char * * commands ;
163165 int ack ;
164166 int is_hasql ;
167+ int sent_client_info ;
168+ void * user_arg ;
169+ int api_call_timeout ;
170+ int connect_timeout ;
171+ int comdb2db_timeout ;
172+ int socket_timeout ;
173+ int * gbl_event_version ; /* Cached global event version */
174+ cdb2_event * events ;
165175 int is_admin ;
166176 int clear_snap_line ;
167177 int debug_trace ;
168178 int max_retries ;
169179 int min_retries ;
170- ssl_mode c_sslmode ; /* client SSL mode */
171- peer_ssl_mode s_sslmode ; /* server SSL mode */
172- int sslerr ; /* 1 if unrecoverable SSL error. */
173- char * sslpath ; /* SSL certificates */
180+ /* client SSL mode */
181+ ssl_mode c_sslmode ;
182+ /* server SSL mode */
183+ peer_ssl_mode s_sslmode ;
184+ /* 1 if unrecoverable SSL error. */
185+ int sslerr ;
186+
187+ /* SSL certificate path. When specified, code looks for $sslpath/root.crt,
188+ $sslpath/client.key, $sslpath/client.crt and $sslpath/root.crl, for
189+ root certificate, client certificate, client key, and root CRL, respectively. */
190+ char * sslpath ;
191+
192+ /* client certificate. overrides sslpath when specified. */
174193 char * cert ;
194+ /* client key. overrides sslpath when specified. */
175195 char * key ;
196+ /* root CA certificate. overrides sslpath when specified. */
176197 char * ca ;
198+ /* root certificate revocation list (CRL). overrides sslpath when specified. */
177199 char * crl ;
178- int cache_ssl_sess ;
200+
201+ /* minimal TLS version. Set it to 0 if we want client and server to negotiate.
202+ The final version will be the minimal version that are mutually understood by
203+ both client and server. Set it to an TLS version (1.2, 1.3, etc.) to override.
204+ Note that if either side does not support the version, handshake will fail. */
179205 double min_tls_ver ;
206+
207+ /* 1 if caching ssl sessions (can speed up SSL handshake) */
208+ int cache_ssl_sess ;
180209 cdb2_ssl_sess * sess ;
181- int nid_dbname ;
182210 /* 1 if it's a newly established session which needs to be cached. */
183211 int newsess ;
212+
213+ /* X509 attribute to check database name against */
214+ int nid_dbname ;
184215 struct context_messages context_msgs ;
185216 char * env_tz ;
186- int sent_client_info ;
187217 char stack [MAX_STACK ];
188218 int send_stack ;
189- void * user_arg ;
190- int * gbl_event_version ; /* Cached global event version */
191- int api_call_timeout ;
192- int connect_timeout ;
193- int comdb2db_timeout ;
194- int socket_timeout ;
195219 int request_fp ; /* 1 if requesting the fingerprint; 0 otherwise. */
196- cdb2_event * events ;
197220 // Protobuf allocator data used only for row data i.e. lastresponse
198221 ProtobufCAllocator s_allocator ;
199222 void * protobuf_data ;
@@ -207,5 +230,4 @@ struct cdb2_hndl {
207230 CDB2SQLQUERY__IdentityBlob * id_blob ;
208231 struct cdb2_stmt_types * stmt_types ;
209232};
210-
211233#endif
0 commit comments