~drizzle-trunk/drizzle/development

971.7.10 by Eric Day
Duplicated oldlibdrizzle module, one for Drizzle protocol and one for MySQL, per Brian's request from merge proposal. Port options are now --drizzle-protocol-port and --mysql-protocol-port.
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
2234 by Brian Aker
Mass removal of ifdef/endif in favor of pragma once.
20
#pragma once
971.7.10 by Eric Day
Duplicated oldlibdrizzle module, one for Drizzle protocol and one for MySQL, per Brian's request from merge proposal. Port options are now --drizzle-protocol-port and --mysql-protocol-port.
21
1964.2.9 by Monty Taylor
All protocol stuff except for the buffer_length. WTF?
22
namespace drizzle_plugin
23
{
971.7.10 by Eric Day
Duplicated oldlibdrizzle module, one for Drizzle protocol and one for MySQL, per Brian's request from merge proposal. Port options are now --drizzle-protocol-port and --mysql-protocol-port.
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
37
struct st_drizzleclient_options {
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 */
2191.1.2 by Brian Aker
Adding SESSION table and adding back in the mysql interactive flag.
82
#define CLIENT_INTERACTIVE      1024
971.7.10 by Eric Day
Duplicated oldlibdrizzle module, one for Drizzle protocol and one for MySQL, per Brian's request from merge proposal. Port options are now --drizzle-protocol-port and --mysql-protocol-port.
83
#define CLIENT_SSL              2048    /* Switch to SSL after handshake */
84
#define CLIENT_IGNORE_SIGPIPE   4096    /* IGNORE sigpipes */
2114.6.1 by Andrew Hutchings
We support transactions, might be good if we told client apps that instead of saying we don't
85
#define CLIENT_TRANSACTIONS     8192    /* Support transactions */
971.7.10 by Eric Day
Duplicated oldlibdrizzle module, one for Drizzle protocol and one for MySQL, per Brian's request from merge proposal. Port options are now --drizzle-protocol-port and --mysql-protocol-port.
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 */
2203.2.2 by Brian Aker
First pass through in going over work for MySQL AUTH PLUGIN style support.
90
#define CLIENT_CAPABILITIES_PLUGIN_AUTH (1 << 19)
971.7.10 by Eric Day
Duplicated oldlibdrizzle module, one for Drizzle protocol and one for MySQL, per Brian's request from merge proposal. Port options are now --drizzle-protocol-port and --mysql-protocol-port.
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 | \
2191.1.2 by Brian Aker
Adding SESSION table and adding back in the mysql interactive flag.
104
                           CLIENT_INTERACTIVE | \
971.7.10 by Eric Day
Duplicated oldlibdrizzle module, one for Drizzle protocol and one for MySQL, per Brian's request from merge proposal. Port options are now --drizzle-protocol-port and --mysql-protocol-port.
105
                           CLIENT_SSL | \
106
                           CLIENT_IGNORE_SIGPIPE | \
2114.6.1 by Andrew Hutchings
We support transactions, might be good if we told client apps that instead of saying we don't
107
                           CLIENT_TRANSACTIONS | \
971.7.10 by Eric Day
Duplicated oldlibdrizzle module, one for Drizzle protocol and one for MySQL, per Brian's request from merge proposal. Port options are now --drizzle-protocol-port and --mysql-protocol-port.
108
                           CLIENT_RESERVED | \
109
                           CLIENT_SECURE_CONNECTION | \
110
                           CLIENT_MULTI_STATEMENTS | \
111
                           CLIENT_MULTI_RESULTS | \
2203.2.2 by Brian Aker
First pass through in going over work for MySQL AUTH PLUGIN style support.
112
                           CLIENT_CAPABILITIES_PLUGIN_AUTH | \
971.7.10 by Eric Day
Duplicated oldlibdrizzle module, one for Drizzle protocol and one for MySQL, per Brian's request from merge proposal. Port options are now --drizzle-protocol-port and --mysql-protocol-port.
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
1964.2.9 by Monty Taylor
All protocol stuff except for the buffer_length. WTF?
125
} /* namespace drizzle_plugin */
126