Drizzled Public API Documentation

options.h
1 /* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3  *
4  * Copyright (C) 2008 Sun Microsystems, Inc.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; version 2 of the License.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
20 #pragma once
21 
22 namespace drizzle_plugin
23 {
24 
25 enum drizzle_option
26 {
27  DRIZZLE_OPT_CONNECT_TIMEOUT, DRIZZLE_OPT_COMPRESS, DRIZZLE_OPT_NAMED_PIPE,
28  DRIZZLE_INIT_COMMAND, DRIZZLE_READ_DEFAULT_FILE, DRIZZLE_READ_DEFAULT_GROUP,
29  DRIZZLE_OPT_PROTOCOL, DRIZZLE_SHARED_MEMORY_BASE_NAME, DRIZZLE_OPT_READ_TIMEOUT,
30  DRIZZLE_OPT_WRITE_TIMEOUT, DRIZZLE_OPT_USE_RESULT,
31  DRIZZLE_OPT_USE_REMOTE_CONNECTION,
32  DRIZZLE_OPT_GUESS_CONNECTION, DRIZZLE_SET_CLIENT_IP, DRIZZLE_SECURE_AUTH,
33  DRIZZLE_REPORT_DATA_TRUNCATION, DRIZZLE_OPT_RECONNECT,
34  DRIZZLE_OPT_SSL_VERIFY_SERVER_CERT
35 };
36 
38  unsigned int connect_timeout, read_timeout, write_timeout;
39  unsigned int port;
40  unsigned long client_flag;
41  char *host,*user,*password,*db;
42  char *my_cnf_file,*my_cnf_group;
43  char *ssl_key; /* PEM key file */
44  char *ssl_cert; /* PEM cert file */
45  char *ssl_ca; /* PEM CA file */
46  char *ssl_capath; /* PEM directory of CA-s? */
47  char *ssl_cipher; /* cipher to use */
48  char *shared_memory_base_name;
49  unsigned long max_allowed_packet;
50  bool use_ssl; /* if to use SSL or not */
51  bool compress,named_pipe;
52  bool unused1;
53  bool unused2;
54  bool unused3;
55  bool unused4;
56  enum drizzle_option methods_to_use;
57  char *client_ip;
58  /* Refuse client connecting to server if it uses old (pre-4.1.1) protocol */
59  bool secure_auth;
60  /* 0 - never report, 1 - always report (default) */
61  bool report_data_truncation;
62 
63  /* function pointers for local infile support */
64  int (*local_infile_init)(void **, const char *, void *);
65  int (*local_infile_read)(void *, char *, unsigned int);
66  void (*local_infile_end)(void *);
67  int (*local_infile_error)(void *, char *, unsigned int);
68  void *local_infile_userdata;
69  void *extension;
70 };
71 
72 
73 #define CLIENT_LONG_PASSWORD 1 /* new more secure passwords */
74 #define CLIENT_FOUND_ROWS 2 /* Found instead of affected rows */
75 #define CLIENT_LONG_FLAG 4 /* Get all column flags */
76 #define CLIENT_CONNECT_WITH_DB 8 /* One can specify db on connect */
77 #define CLIENT_NO_SCHEMA 16 /* Don't allow database.table.column */
78 #define CLIENT_COMPRESS 32 /* Can use compression protocol */
79 #define CLIENT_ODBC 64 /* Odbc client */
80 #define CLIENT_IGNORE_SPACE 256 /* Ignore spaces before '(' */
81 #define CLIENT_PROTOCOL_MYSQL41 512 /* New 4.1 protocol */
82 #define CLIENT_INTERACTIVE 1024
83 #define CLIENT_SSL 2048 /* Switch to SSL after handshake */
84 #define CLIENT_IGNORE_SIGPIPE 4096 /* IGNORE sigpipes */
85 #define CLIENT_TRANSACTIONS 8192 /* Support transactions */
86 #define CLIENT_RESERVED 16384 /* Old flag for 4.1 protocol */
87 #define CLIENT_SECURE_CONNECTION 32768 /* New 4.1 authentication */
88 #define CLIENT_MULTI_STATEMENTS (1UL << 16) /* Enable/disable multi-stmt support */
89 #define CLIENT_MULTI_RESULTS (1UL << 17) /* Enable/disable multi-results */
90 #define CLIENT_CAPABILITIES_PLUGIN_AUTH (1 << 19)
91 
92 #define CLIENT_SSL_VERIFY_SERVER_CERT (1UL << 30)
93 #define CLIENT_REMEMBER_OPTIONS (1UL << 31)
94 
95 /* Gather all possible capabilites (flags) supported by the server */
96 #define CLIENT_ALL_FLAGS (CLIENT_LONG_PASSWORD | \
97  CLIENT_FOUND_ROWS | \
98  CLIENT_LONG_FLAG | \
99  CLIENT_CONNECT_WITH_DB | \
100  CLIENT_NO_SCHEMA | \
101  CLIENT_COMPRESS | \
102  CLIENT_ODBC | \
103  CLIENT_IGNORE_SPACE | \
104  CLIENT_INTERACTIVE | \
105  CLIENT_SSL | \
106  CLIENT_IGNORE_SIGPIPE | \
107  CLIENT_TRANSACTIONS | \
108  CLIENT_RESERVED | \
109  CLIENT_SECURE_CONNECTION | \
110  CLIENT_MULTI_STATEMENTS | \
111  CLIENT_MULTI_RESULTS | \
112  CLIENT_CAPABILITIES_PLUGIN_AUTH | \
113  CLIENT_SSL_VERIFY_SERVER_CERT | \
114  CLIENT_REMEMBER_OPTIONS)
115 
116 /*
117  Switch off the flags that are optional and depending on build flags
118  If any of the optional flags is supported by the build it will be switched
119  on before sending to the client during the connection handshake.
120 */
121 #define CLIENT_BASIC_FLAGS (((CLIENT_ALL_FLAGS & ~CLIENT_SSL) \
122  & ~CLIENT_COMPRESS) \
123  & ~CLIENT_SSL_VERIFY_SERVER_CERT)
124 
125 } /* namespace drizzle_plugin */
126