MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ndb_opts.h
1 /*
2  Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; version 2 of the License.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software
15  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17 
18 #ifndef _NDB_OPTS_H
19 #define _NDB_OPTS_H
20 
21 #include <ndb_global.h>
22 
23 #include <my_sys.h> /* loglevel needed by my_getopt.h */
24 #include <my_getopt.h>
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 #ifdef OPTEXPORT
31 #define OPT_EXTERN(T,V,I) T V I
32 #else
33 #define OPT_EXTERN(T,V,I) extern T V
34 #endif
35 
36 #define NONE
37 OPT_EXTERN(int,opt_ndb_nodeid,NONE);
38 OPT_EXTERN(my_bool,opt_ndb_endinfo,=0);
39 OPT_EXTERN(my_bool,opt_core,NONE);
40 OPT_EXTERN(my_bool,opt_ndb_optimized_node_selection,NONE);
41 OPT_EXTERN(const char *,opt_ndb_connectstring,=0);
42 
43 #ifndef DBUG_OFF
44 OPT_EXTERN(const char *,opt_debug,= 0);
45 #endif
46 
47 #if defined VM_TRACE
48 #define OPT_WANT_CORE_DEFAULT 1
49 #else
50 #define OPT_WANT_CORE_DEFAULT 0
51 #endif
52 
53 #define NDB_STD_OPTS_COMMON \
54  { "usage", '?', "Display this help and exit.", \
55  0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, \
56  { "help", '?', "Display this help and exit.", \
57  0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, \
58  { "version", 'V', "Output version information and exit.", 0, 0, 0, \
59  GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, \
60  { "ndb-connectstring", OPT_NDB_CONNECTSTRING, \
61  "Set connect string for connecting to ndb_mgmd. " \
62  "Syntax: \"[nodeid=<id>;][host=]<hostname>[:<port>]\". " \
63  "Overrides specifying entries in NDB_CONNECTSTRING and my.cnf", \
64  (uchar**) &opt_ndb_connectstring, (uchar**) &opt_ndb_connectstring, \
65  0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\
66  { "ndb-mgmd-host", NDB_OPT_NOSHORT, \
67  "same as --ndb-connectstring", \
68  (uchar**) &opt_ndb_connectstring, (uchar**) &opt_ndb_connectstring, 0, \
69  GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\
70  { "ndb-nodeid", NDB_OPT_NOSHORT, \
71  "Set node id for this node. Overrides node id specified " \
72  "in --ndb-connectstring.", \
73  (uchar**) &opt_ndb_nodeid, (uchar**) &opt_ndb_nodeid, 0, \
74  GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\
75  {"ndb-optimized-node-selection", NDB_OPT_NOSHORT,\
76  "Select nodes for transactions in a more optimal way",\
77  (uchar**) &opt_ndb_optimized_node_selection,\
78  (uchar**) &opt_ndb_optimized_node_selection, 0,\
79  GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},\
80  { "connect-string", OPT_NDB_CONNECTSTRING, "same as --ndb-connectstring",\
81  (uchar**) &opt_ndb_connectstring, (uchar**) &opt_ndb_connectstring, \
82  0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\
83  { "core-file", NDB_OPT_NOSHORT, "Write core on errors.",\
84  (uchar**) &opt_core, (uchar**) &opt_core, 0,\
85  GET_BOOL, NO_ARG, OPT_WANT_CORE_DEFAULT, 0, 0, 0, 0, 0},\
86  {"character-sets-dir", NDB_OPT_NOSHORT,\
87  "Directory where character sets are.", (uchar**) &charsets_dir,\
88  (uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}\
89 
90 #ifndef DBUG_OFF
91 #define NDB_STD_OPTS(prog_name) \
92  { "debug", '#', "Output debug log. Often this is 'd:t:o,filename'.", \
93  (uchar**) &opt_debug, (uchar**) &opt_debug, \
94  0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0 }, \
95  NDB_STD_OPTS_COMMON
96 #else
97 #define NDB_STD_OPTS(prog_name) NDB_STD_OPTS_COMMON
98 #endif
99 
100 void ndb_std_print_version();
101 
102 enum ndb_std_options {
103  /*
104  --ndb-connectstring=<connectstring> has short form 'c'
105  */
106  OPT_NDB_CONNECTSTRING = 'c',
107 
108  /*
109  For arguments that have neither a short form option or need
110  special processing in 'get_one_option' callback
111  */
112  NDB_OPT_NOSHORT = 256,
113 
114  /*
115  should always be last in this enum and will be used as the
116  start value by programs which use 'ndb_std_get_one_option' and
117  need to define their own arguments with special processing
118  */
119  NDB_STD_OPTIONS_LAST
120 };
121 
122 void ndb_opt_set_usage_funcs(void (*short_usage)(void),
123  void (*usage)(void));
124 my_bool
125 ndb_std_get_one_option(int optid,
126  const struct my_option *opt __attribute__((unused)),
127  char *argument);
128 
129 void ndb_usage(void (*usagefunc)(void), const char *load_default_groups[],
130  struct my_option *my_long_options);
131 void ndb_short_usage_sub(const char* extra);
132 
133 my_bool ndb_is_load_default_arg_separator(const char* arg);
134 
135 #ifdef __cplusplus
136 }
137 #endif
138 
139 #endif /*_NDB_OPTS_H */