~drizzle-trunk/drizzle/development

383.1.45 by Monty Taylor
libdrizzle.h cleanup. Removed some unused things. Started splitting header into
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
390.1.3 by Monty Taylor
Copyright header fixes.
8
 *  the Free Software Foundation; version 2 of the License.
383.1.45 by Monty Taylor
libdrizzle.h cleanup. Removed some unused things. Started splitting header into
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
971.7.11 by Eric Day
Fixed header file guards and fixed test cases.
20
#ifndef PLUGIN_DRIZZLE_PROTOCOL_OPTIONS_H
21
#define PLUGIN_DRIZZLE_PROTOCOL_OPTIONS_H
383.1.45 by Monty Taylor
libdrizzle.h cleanup. Removed some unused things. Started splitting header into
22
1300.5.1 by Monty Taylor
Put drizzle_protocol plugin in to its own namespace so that symbols won't
23
namespace drizzle_protocol
24
{
779.3.37 by Monty Taylor
Renmaed libdrizzle in the tree to libdrizzleclient to avoid namespace clashes
25
383.1.45 by Monty Taylor
libdrizzle.h cleanup. Removed some unused things. Started splitting header into
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
840.1.21 by Monty Taylor
ZOMG. Renamed all the rest of the stuff in libdrizzleclient to be drizzleclient_*. I love commandline perl.
38
struct st_drizzleclient_options {
383.1.45 by Monty Taylor
libdrizzle.h cleanup. Removed some unused things. Started splitting header into
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
971.7.1 by Eric Day
Client/Listen cleanup, moved globals, console plugin cleanup.
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 '(' */
971.7.8 by Eric Day
Moved port options into protocol plugin and added MySQL protocol support.
85
#define CLIENT_PROTOCOL_MYSQL41 512     /* New 4.1 protocol */
971.7.1 by Eric Day
Client/Listen cleanup, moved globals, console plugin cleanup.
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_SSL_VERIFY_SERVER_CERT (1UL << 30)
94
#define CLIENT_REMEMBER_OPTIONS (1UL << 31)
95
96
/* Gather all possible capabilites (flags) supported by the server */
97
#define CLIENT_ALL_FLAGS  (CLIENT_LONG_PASSWORD | \
98
                           CLIENT_FOUND_ROWS | \
99
                           CLIENT_LONG_FLAG | \
100
                           CLIENT_CONNECT_WITH_DB | \
101
                           CLIENT_NO_SCHEMA | \
102
                           CLIENT_COMPRESS | \
103
                           CLIENT_ODBC | \
104
                           CLIENT_IGNORE_SPACE | \
105
                           CLIENT_SSL | \
106
                           CLIENT_IGNORE_SIGPIPE | \
107
                           CLIENT_RESERVED | \
108
                           CLIENT_SECURE_CONNECTION | \
109
                           CLIENT_MULTI_STATEMENTS | \
110
                           CLIENT_MULTI_RESULTS | \
111
                           CLIENT_SSL_VERIFY_SERVER_CERT | \
112
                           CLIENT_REMEMBER_OPTIONS)
113
114
/*
115
  Switch off the flags that are optional and depending on build flags
116
  If any of the optional flags is supported by the build it will be switched
117
  on before sending to the client during the connection handshake.
118
*/
119
#define CLIENT_BASIC_FLAGS (((CLIENT_ALL_FLAGS & ~CLIENT_SSL) \
120
                                               & ~CLIENT_COMPRESS) \
121
                                               & ~CLIENT_SSL_VERIFY_SERVER_CERT)
122
1320.2.1 by Monty Taylor
Merged in drizzle_protocol namespace change.
123
} /* namespace drizzle_protocol */
124
971.7.11 by Eric Day
Fixed header file guards and fixed test cases.
125
#endif /* PLUGIN_DRIZZLE_PROTOCOL_OPTIONS_H */