2626#include  <sys/types.h> 
2727#include  <sys/queue.h> 
2828
29- #define  MAX_NODES  128 
29+ #define  MAX_NODES  48 
3030
31- #define  DBNAME_LEN  64 
32- #define  TYPE_LEN  64 
31+ #define  DBNAME_LEN  32 
32+ #define  TYPE_LEN  32 
3333#define  POLICY_LEN  24
3434
35- #define  CDB2HOSTNAME_LEN  128 
35+ #define  CDB2HOSTNAME_LEN  64 
3636
3737#define  MAX_STACK  512 /* Size of call-stack which opened the handle */ 
3838
@@ -111,7 +111,7 @@ typedef struct cdb2_ssl_sess cdb2_ssl_sess;
111111
112112struct  cdb2_hndl  {
113113    char  dbname [DBNAME_LEN ];
114-     char  cluster [64 ];
114+     char  cluster [32 ];
115115    char  type [TYPE_LEN ];
116116    char  hosts [MAX_NODES ][CDB2HOSTNAME_LEN ];
117117    uint64_t  timestampus ; // client query timestamp of first try 
@@ -121,6 +121,9 @@ struct cdb2_hndl {
121121    char  cached_host [CDB2HOSTNAME_LEN ]; /* hostname of a sockpool connection */ 
122122    int  cached_port ;                    /* port of a sockpool connection */ 
123123    SBUF2  * sb ;
124+     int  num_set_commands ;
125+     int  num_set_commands_sent ;
126+     char  * * commands ;
124127    int  dbnum ;
125128    int  num_hosts ;          /* total number of hosts */ 
126129    int  num_hosts_sameroom ; /* number of hosts that are in my datacenter (aka room) */ 
@@ -142,9 +145,9 @@ struct cdb2_hndl {
142145    char  * sql ;
143146    int  ntypes ;
144147    int  * types ;
145-     uint8_t  * last_buf ;
148+     unsigned  char   * last_buf ;
146149    CDB2SQLRESPONSE  * lastresponse ;
147-     uint8_t  * first_buf ;
150+     unsigned  char   * first_buf ;
148151    CDB2SQLRESPONSE  * firstresponse ;
149152    int  error_in_trans ;
150153    int  client_side_error ;
@@ -155,54 +158,72 @@ struct cdb2_hndl {
155158    int  snapshot_offset ;
156159    int  query_no ;
157160    int  retry_all ;
158-     int  num_set_commands ;
159-     int  num_set_commands_sent ;
160161    int  is_read ;
161162    int  is_invalid ;
162163    int  is_rejected ;
163164    unsigned long long  rows_read ;
164165    int  read_intrans_results ;
165166    int  first_record_read ;
166-     char  * * commands ;
167167    int  ack ;
168168    int  is_hasql ;
169+     int  sent_client_info ;
170+     void  * user_arg ;
171+     int  api_call_timeout ;
172+     int  connect_timeout ;
173+     int  comdb2db_timeout ;
174+     int  socket_timeout ;
175+     int  sockpool_send_timeoutms ;
176+     int  sockpool_recv_timeoutms ;
177+     int  * gbl_event_version ; /* Cached global event version */ 
178+     cdb2_event  * events ;
179+     pid_t  pid ;
169180    int  is_admin ;
170181    int  sockpool_enabled ;
171182    int  db_default_type_override_env ;
172183    int  clear_snap_line ;
173184    int  debug_trace ;
174185    int  max_retries ;
175186    int  min_retries ;
176-     ssl_mode  c_sslmode ;      /* client SSL mode */ 
177-     peer_ssl_mode  s_sslmode ; /* server SSL mode */ 
178-     int  sslerr ;              /* 1 if unrecoverable SSL error. */ 
179-     char  * sslpath ;           /* SSL certificates */ 
187+     /* client SSL mode */ 
188+     ssl_mode  c_sslmode ;
189+     /* server SSL mode */ 
190+     peer_ssl_mode  s_sslmode ;
191+     /* 1 if unrecoverable SSL error. */ 
192+     int  sslerr ;
193+ 
194+     /* SSL certificate path. When specified, code looks for $sslpath/root.crt, 
195+        $sslpath/client.key, $sslpath/client.crt and $sslpath/root.crl, for 
196+        root certificate, client certificate, client key, and root CRL, respectively. */ 
197+     char  * sslpath ;
198+ 
199+     /* client certificate. overrides sslpath when specified. */ 
180200    char  * cert ;
201+     /* client key. overrides sslpath when specified. */ 
181202    char  * key ;
203+     /* root CA certificate. overrides sslpath when specified. */ 
182204    char  * ca ;
205+     /* root certificate revocation list (CRL). overrides sslpath when specified. */ 
183206    char  * crl ;
184-     int  cache_ssl_sess ;
207+ 
208+     /* minimal TLS version. Set it to 0 if we want client and server to negotiate. 
209+        The final version will be the minimal version that are mutually understood by 
210+        both client and server. Set it to an TLS version (1.2, 1.3, etc.) to override. 
211+        Note that if either side does not support the version, handshake will fail. */ 
185212    double  min_tls_ver ;
213+ 
214+     /* 1 if caching ssl sessions (can speed up SSL handshake) */ 
215+     int  cache_ssl_sess ;
186216    cdb2_ssl_sess  * sess ;
187-     int  nid_dbname ;
188217    /* 1 if it's a newly established session which needs to be cached. */ 
189218    int  newsess ;
219+ 
220+     /* X509 attribute to check database name against */ 
221+     int  nid_dbname ;
190222    struct  context_messages  context_msgs ;
191223    char  * env_tz ;
192-     int  sent_client_info ;
193224    char  stack [MAX_STACK ];
194225    int  send_stack ;
195-     void  * user_arg ;
196-     int  * gbl_event_version ; /* Cached global event version */ 
197-     int  api_call_timeout ;
198-     int  connect_timeout ;
199-     int  comdb2db_timeout ;
200-     int  socket_timeout ;
201-     int  sockpool_send_timeoutms ;
202-     int  sockpool_recv_timeoutms ;
203226    int  request_fp ; /* 1 if requesting the fingerprint; 0 otherwise. */ 
204-     cdb2_event  * events ;
205-     pid_t  pid ;
206227    // Protobuf allocator data used only for row data i.e. lastresponse 
207228    ProtobufCAllocator  s_allocator ;
208229    void  * protobuf_data ;
@@ -217,5 +238,4 @@ struct cdb2_hndl {
217238    struct  cdb2_stmt_types  * stmt_types ;
218239    RETRY_CALLBACK  retry_clbk ;
219240};
220- 
221241#endif 
0 commit comments