~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/mysql_protocol/options.h

  • Committer: Patrick Galbraith
  • Date: 2009-10-08 22:42:05 UTC
  • mto: (1166.5.3 memcached_functions)
  • mto: This revision was merged to the branch mainline in revision 1189.
  • Revision ID: patg@patrick-galbraiths-macbook-pro.local-20091008224205-gq1pehjsivvx0qo9
Starting over with a fresh tree, moved in memcached functions.

Memcached Functions for Drizzle. 

All tests pass.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
#ifndef PLUGIN_MYSQL_PROTOCOL_OPTIONS_H
21
 
#define PLUGIN_MYSQL_PROTOCOL_OPTIONS_H
22
 
 
23
 
namespace drizzle_plugin
24
 
{
25
 
 
26
 
enum drizzle_option
27
 
{
28
 
  DRIZZLE_OPT_CONNECT_TIMEOUT, DRIZZLE_OPT_COMPRESS, DRIZZLE_OPT_NAMED_PIPE,
29
 
  DRIZZLE_INIT_COMMAND, DRIZZLE_READ_DEFAULT_FILE, DRIZZLE_READ_DEFAULT_GROUP,
30
 
  DRIZZLE_OPT_PROTOCOL, DRIZZLE_SHARED_MEMORY_BASE_NAME, DRIZZLE_OPT_READ_TIMEOUT,
31
 
  DRIZZLE_OPT_WRITE_TIMEOUT, DRIZZLE_OPT_USE_RESULT,
32
 
  DRIZZLE_OPT_USE_REMOTE_CONNECTION,
33
 
  DRIZZLE_OPT_GUESS_CONNECTION, DRIZZLE_SET_CLIENT_IP, DRIZZLE_SECURE_AUTH,
34
 
  DRIZZLE_REPORT_DATA_TRUNCATION, DRIZZLE_OPT_RECONNECT,
35
 
  DRIZZLE_OPT_SSL_VERIFY_SERVER_CERT
36
 
};
37
 
 
38
 
struct st_drizzleclient_options {
39
 
  unsigned int connect_timeout, read_timeout, write_timeout;
40
 
  unsigned int port;
41
 
  unsigned long client_flag;
42
 
  char *host,*user,*password,*db;
43
 
  char *my_cnf_file,*my_cnf_group;
44
 
  char *ssl_key;        /* PEM key file */
45
 
  char *ssl_cert;        /* PEM cert file */
46
 
  char *ssl_ca;          /* PEM CA file */
47
 
  char *ssl_capath;        /* PEM directory of CA-s? */
48
 
  char *ssl_cipher;        /* cipher to use */
49
 
  char *shared_memory_base_name;
50
 
  unsigned long max_allowed_packet;
51
 
  bool use_ssl;        /* if to use SSL or not */
52
 
  bool compress,named_pipe;
53
 
  bool unused1;
54
 
  bool unused2;
55
 
  bool unused3;
56
 
  bool unused4;
57
 
  enum drizzle_option methods_to_use;
58
 
  char *client_ip;
59
 
  /* Refuse client connecting to server if it uses old (pre-4.1.1) protocol */
60
 
  bool secure_auth;
61
 
  /* 0 - never report, 1 - always report (default) */
62
 
  bool report_data_truncation;
63
 
 
64
 
  /* function pointers for local infile support */
65
 
  int (*local_infile_init)(void **, const char *, void *);
66
 
  int (*local_infile_read)(void *, char *, unsigned int);
67
 
  void (*local_infile_end)(void *);
68
 
  int (*local_infile_error)(void *, char *, unsigned int);
69
 
  void *local_infile_userdata;
70
 
  void *extension;
71
 
};
72
 
 
73
 
 
74
 
#define CLIENT_NET_READ_TIMEOUT    365*24*3600  /* Timeout on read */
75
 
#define CLIENT_NET_WRITE_TIMEOUT  365*24*3600  /* Timeout on write */
76
 
 
77
 
#define CLIENT_LONG_PASSWORD    1       /* new more secure passwords */
78
 
#define CLIENT_FOUND_ROWS       2       /* Found instead of affected rows */
79
 
#define CLIENT_LONG_FLAG        4       /* Get all column flags */
80
 
#define CLIENT_CONNECT_WITH_DB  8       /* One can specify db on connect */
81
 
#define CLIENT_NO_SCHEMA        16      /* Don't allow database.table.column */
82
 
#define CLIENT_COMPRESS         32      /* Can use compression protocol */
83
 
#define CLIENT_ODBC             64      /* Odbc client */
84
 
#define CLIENT_IGNORE_SPACE     256     /* Ignore spaces before '(' */
85
 
#define CLIENT_PROTOCOL_MYSQL41 512     /* New 4.1 protocol */
86
 
#define CLIENT_SSL              2048    /* Switch to SSL after handshake */
87
 
#define CLIENT_IGNORE_SIGPIPE   4096    /* IGNORE sigpipes */
88
 
#define CLIENT_RESERVED         16384   /* Old flag for 4.1 protocol  */
89
 
#define CLIENT_SECURE_CONNECTION 32768  /* New 4.1 authentication */
90
 
#define CLIENT_MULTI_STATEMENTS (1UL << 16) /* Enable/disable multi-stmt support */
91
 
#define CLIENT_MULTI_RESULTS    (1UL << 17) /* Enable/disable multi-results */
92
 
 
93
 
#define CLIENT_ADMIN            (1UL << 25) /* Admin client connection */
94
 
 
95
 
#define CLIENT_SSL_VERIFY_SERVER_CERT (1UL << 30)
96
 
#define CLIENT_REMEMBER_OPTIONS (1UL << 31)
97
 
 
98
 
/* Gather all possible capabilites (flags) supported by the server */
99
 
#define CLIENT_ALL_FLAGS  (CLIENT_LONG_PASSWORD | \
100
 
                           CLIENT_FOUND_ROWS | \
101
 
                           CLIENT_LONG_FLAG | \
102
 
                           CLIENT_CONNECT_WITH_DB | \
103
 
                           CLIENT_NO_SCHEMA | \
104
 
                           CLIENT_COMPRESS | \
105
 
                           CLIENT_ODBC | \
106
 
                           CLIENT_IGNORE_SPACE | \
107
 
                           CLIENT_SSL | \
108
 
                           CLIENT_IGNORE_SIGPIPE | \
109
 
                           CLIENT_RESERVED | \
110
 
                           CLIENT_SECURE_CONNECTION | \
111
 
                           CLIENT_MULTI_STATEMENTS | \
112
 
                           CLIENT_MULTI_RESULTS | \
113
 
                           CLIENT_ADMIN | \
114
 
                           CLIENT_SSL_VERIFY_SERVER_CERT | \
115
 
                           CLIENT_REMEMBER_OPTIONS)
116
 
 
117
 
/*
118
 
  Switch off the flags that are optional and depending on build flags
119
 
  If any of the optional flags is supported by the build it will be switched
120
 
  on before sending to the client during the connection handshake.
121
 
*/
122
 
#define CLIENT_BASIC_FLAGS (((CLIENT_ALL_FLAGS & ~CLIENT_SSL) \
123
 
                                               & ~CLIENT_COMPRESS) \
124
 
                                               & ~CLIENT_SSL_VERIFY_SERVER_CERT)
125
 
 
126
 
} /* namespace drizzle_plugin */
127
 
 
128
 
#endif /* PLUGIN_MYSQL_PROTOCOL_OPTIONS_H */