Drizzled Public API Documentation

options.h
00001 /* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
00002  *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
00003  *
00004  *  Copyright (C) 2008 Sun Microsystems, Inc.
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; version 2 of the License.
00009  *
00010  *  This program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *  GNU General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with this program; if not, write to the Free Software
00017  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018  */
00019 
00020 #pragma once
00021 
00022 namespace drizzle_plugin
00023 {
00024 
00025 enum drizzle_option
00026 {
00027   DRIZZLE_OPT_CONNECT_TIMEOUT, DRIZZLE_OPT_COMPRESS, DRIZZLE_OPT_NAMED_PIPE,
00028   DRIZZLE_INIT_COMMAND, DRIZZLE_READ_DEFAULT_FILE, DRIZZLE_READ_DEFAULT_GROUP,
00029   DRIZZLE_OPT_PROTOCOL, DRIZZLE_SHARED_MEMORY_BASE_NAME, DRIZZLE_OPT_READ_TIMEOUT,
00030   DRIZZLE_OPT_WRITE_TIMEOUT, DRIZZLE_OPT_USE_RESULT,
00031   DRIZZLE_OPT_USE_REMOTE_CONNECTION,
00032   DRIZZLE_OPT_GUESS_CONNECTION, DRIZZLE_SET_CLIENT_IP, DRIZZLE_SECURE_AUTH,
00033   DRIZZLE_REPORT_DATA_TRUNCATION, DRIZZLE_OPT_RECONNECT,
00034   DRIZZLE_OPT_SSL_VERIFY_SERVER_CERT
00035 };
00036 
00037 struct st_drizzleclient_options {
00038   unsigned int connect_timeout, read_timeout, write_timeout;
00039   unsigned int port;
00040   unsigned long client_flag;
00041   char *host,*user,*password,*db;
00042   char *my_cnf_file,*my_cnf_group;
00043   char *ssl_key;        /* PEM key file */
00044   char *ssl_cert;        /* PEM cert file */
00045   char *ssl_ca;          /* PEM CA file */
00046   char *ssl_capath;        /* PEM directory of CA-s? */
00047   char *ssl_cipher;        /* cipher to use */
00048   char *shared_memory_base_name;
00049   unsigned long max_allowed_packet;
00050   bool use_ssl;        /* if to use SSL or not */
00051   bool compress,named_pipe;
00052   bool unused1;
00053   bool unused2;
00054   bool unused3;
00055   bool unused4;
00056   enum drizzle_option methods_to_use;
00057   char *client_ip;
00058   /* Refuse client connecting to server if it uses old (pre-4.1.1) protocol */
00059   bool secure_auth;
00060   /* 0 - never report, 1 - always report (default) */
00061   bool report_data_truncation;
00062 
00063   /* function pointers for local infile support */
00064   int (*local_infile_init)(void **, const char *, void *);
00065   int (*local_infile_read)(void *, char *, unsigned int);
00066   void (*local_infile_end)(void *);
00067   int (*local_infile_error)(void *, char *, unsigned int);
00068   void *local_infile_userdata;
00069   void *extension;
00070 };
00071 
00072 
00073 #define CLIENT_LONG_PASSWORD    1       /* new more secure passwords */
00074 #define CLIENT_FOUND_ROWS       2       /* Found instead of affected rows */
00075 #define CLIENT_LONG_FLAG        4       /* Get all column flags */
00076 #define CLIENT_CONNECT_WITH_DB  8       /* One can specify db on connect */
00077 #define CLIENT_NO_SCHEMA        16      /* Don't allow database.table.column */
00078 #define CLIENT_COMPRESS         32      /* Can use compression protocol */
00079 #define CLIENT_ODBC             64      /* Odbc client */
00080 #define CLIENT_IGNORE_SPACE     256     /* Ignore spaces before '(' */
00081 #define CLIENT_PROTOCOL_MYSQL41 512     /* New 4.1 protocol */
00082 #define CLIENT_INTERACTIVE      1024
00083 #define CLIENT_SSL              2048    /* Switch to SSL after handshake */
00084 #define CLIENT_IGNORE_SIGPIPE   4096    /* IGNORE sigpipes */
00085 #define CLIENT_TRANSACTIONS     8192    /* Support transactions */
00086 #define CLIENT_RESERVED         16384   /* Old flag for 4.1 protocol  */
00087 #define CLIENT_SECURE_CONNECTION 32768  /* New 4.1 authentication */
00088 #define CLIENT_MULTI_STATEMENTS (1UL << 16) /* Enable/disable multi-stmt support */
00089 #define CLIENT_MULTI_RESULTS    (1UL << 17) /* Enable/disable multi-results */
00090 #define CLIENT_CAPABILITIES_PLUGIN_AUTH (1 << 19)
00091 
00092 #define CLIENT_ADMIN            (1UL << 25) /* Admin client connection */
00093 
00094 #define CLIENT_SSL_VERIFY_SERVER_CERT (1UL << 30)
00095 #define CLIENT_REMEMBER_OPTIONS (1UL << 31)
00096 
00097 /* Gather all possible capabilites (flags) supported by the server */
00098 #define CLIENT_ALL_FLAGS  (CLIENT_LONG_PASSWORD | \
00099                            CLIENT_FOUND_ROWS | \
00100                            CLIENT_LONG_FLAG | \
00101                            CLIENT_CONNECT_WITH_DB | \
00102                            CLIENT_NO_SCHEMA | \
00103                            CLIENT_COMPRESS | \
00104                            CLIENT_ODBC | \
00105                            CLIENT_IGNORE_SPACE | \
00106                            CLIENT_INTERACTIVE | \
00107                            CLIENT_SSL | \
00108                            CLIENT_IGNORE_SIGPIPE | \
00109                            CLIENT_TRANSACTIONS | \
00110                            CLIENT_RESERVED | \
00111                            CLIENT_SECURE_CONNECTION | \
00112                            CLIENT_MULTI_STATEMENTS | \
00113                            CLIENT_MULTI_RESULTS | \
00114                            CLIENT_CAPABILITIES_PLUGIN_AUTH | \
00115                            CLIENT_ADMIN | \
00116                            CLIENT_SSL_VERIFY_SERVER_CERT | \
00117                            CLIENT_REMEMBER_OPTIONS)
00118 
00119 /*
00120   Switch off the flags that are optional and depending on build flags
00121   If any of the optional flags is supported by the build it will be switched
00122   on before sending to the client during the connection handshake.
00123 */
00124 #define CLIENT_BASIC_FLAGS (((CLIENT_ALL_FLAGS & ~CLIENT_SSL) \
00125                                                & ~CLIENT_COMPRESS) \
00126                                                & ~CLIENT_SSL_VERIFY_SERVER_CERT)
00127 
00128 } /* namespace drizzle_plugin */
00129