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