~ubuntu-branches/ubuntu/saucy/drizzle/saucy-proposed

« back to all changes in this revision

Viewing changes to plugin/mysql_protocol/options.h

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2010-03-18 12:12:31 UTC
  • Revision ID: james.westby@ubuntu.com-20100318121231-k6g1xe6cshbwa0f8
Tags: upstream-2010.03.1347
ImportĀ upstreamĀ versionĀ 2010.03.1347

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