1 /** @file shishi_cmd.h 2 * @brief The header file for the command line option parser 3 * generated by GNU Gengetopt version 2.22.5 4 * http://www.gnu.org/software/gengetopt. 5 * DO NOT modify this file, since it can be overwritten 6 * @author GNU Gengetopt by Lorenzo Bettini */ 7 8 #ifndef SHISHI_CMD_H 9 #define SHISHI_CMD_H 10 11 /* If we use autoconf. */ 12 #ifdef HAVE_CONFIG_H 13 #include "config.h" 14 #endif 15 16 #include <stdio.h> /* for FILE */ 17 18 #ifdef __cplusplus 19 extern "C" { 20 #endif /* __cplusplus */ 21 22 #ifndef CMDLINE_PARSER_PACKAGE 23 /** @brief the program name (used for printing errors) */ 24 #define CMDLINE_PARSER_PACKAGE "shishi" 25 #endif 26 27 #ifndef CMDLINE_PARSER_PACKAGE_NAME 28 /** @brief the complete program name (used for help and version) */ 29 #define CMDLINE_PARSER_PACKAGE_NAME "shishi" 30 #endif 31 32 #ifndef CMDLINE_PARSER_VERSION 33 /** @brief the program version */ 34 #define CMDLINE_PARSER_VERSION VERSION 35 #endif 36 37 /** @brief Where the command line options are stored */ 38 struct gengetopt_args_info 39 { 40 const char *help_help; /**< @brief Print help and exit help description. */ 41 const char *version_help; /**< @brief Print version and exit help description. */ 42 int destroy_flag; /**< @brief Destroy tickets in local cache, limited by any --client-name or --server-name. (default=off). */ 43 const char *destroy_help; /**< @brief Destroy tickets in local cache, limited by any --client-name or --server-name. help description. */ 44 int list_flag; /**< @brief List tickets in local cache, limited by any --client-name and --server-name. (default=off). */ 45 const char *list_help; /**< @brief List tickets in local cache, limited by any --client-name and --server-name. help description. */ 46 int renew_flag; /**< @brief Renew ticket. Use --server-name to specify ticket, default is the most recent renewable ticket granting ticket for the default realm. (default=off). */ 47 const char *renew_help; /**< @brief Renew ticket. Use --server-name to specify ticket, default is the most recent renewable ticket granting ticket for the default realm. help description. */ 48 int forwardable_flag; /**< @brief Get a forwardable ticket, i.e., one that can be used to get forwarded tickets. (default=off). */ 49 const char *forwardable_help; /**< @brief Get a forwardable ticket, i.e., one that can be used to get forwarded tickets. help description. */ 50 int forwarded_flag; /**< @brief Get a forwarded ticket. (default=off). */ 51 const char *forwarded_help; /**< @brief Get a forwarded ticket. help description. */ 52 int proxiable_flag; /**< @brief Get a proxiable ticket, i.e., one that can be used to get proxy tickets. (default=off). */ 53 const char *proxiable_help; /**< @brief Get a proxiable ticket, i.e., one that can be used to get proxy tickets. help description. */ 54 int proxy_flag; /**< @brief Get a proxy ticket. (default=off). */ 55 const char *proxy_help; /**< @brief Get a proxy ticket. help description. */ 56 int renewable_flag; /**< @brief Get a renewable ticket. (default=off). */ 57 const char *renewable_help; /**< @brief Get a renewable ticket. help description. */ 58 char * client_name_arg; /**< @brief Client name. Default is login username.. */ 59 char * client_name_orig; /**< @brief Client name. Default is login username. original value given at command line. */ 60 const char *client_name_help; /**< @brief Client name. Default is login username. help description. */ 61 char * encryption_type_arg; /**< @brief Encryption types to use. ETYPE is either registered name or integer. Valid values include 'aes128', 'aes256', 'aes' (same as 'aes256'), '3des', 'des-md5', 'des-md4', 'des-crc', 'des' (same as 'des-md5'), and 'arcfour'.. */ 62 char * encryption_type_orig; /**< @brief Encryption types to use. ETYPE is either registered name or integer. Valid values include 'aes128', 'aes256', 'aes' (same as 'aes256'), '3des', 'des-md5', 'des-md4', 'des-crc', 'des' (same as 'des-md5'), and 'arcfour'. original value given at command line. */ 63 const char *encryption_type_help; /**< @brief Encryption types to use. ETYPE is either registered name or integer. Valid values include 'aes128', 'aes256', 'aes' (same as 'aes256'), '3des', 'des-md5', 'des-md4', 'des-crc', 'des' (same as 'des-md5'), and 'arcfour'. help description. */ 64 char * endtime_arg; /**< @brief Specify when ticket validity should expire. The time syntax may be relative (to the start time), such as '20 hours', or absolute, such as '2001-02-03 04:05:06 CET'. The default is 8 hours after the start time.. */ 65 char * endtime_orig; /**< @brief Specify when ticket validity should expire. The time syntax may be relative (to the start time), such as '20 hours', or absolute, such as '2001-02-03 04:05:06 CET'. The default is 8 hours after the start time. original value given at command line. */ 66 const char *endtime_help; /**< @brief Specify when ticket validity should expire. The time syntax may be relative (to the start time), such as '20 hours', or absolute, such as '2001-02-03 04:05:06 CET'. The default is 8 hours after the start time. help description. */ 67 char * realm_arg; /**< @brief Set default realm.. */ 68 char * realm_orig; /**< @brief Set default realm. original value given at command line. */ 69 const char *realm_help; /**< @brief Set default realm. help description. */ 70 char * renew_till_arg; /**< @brief Specify renewable life of ticket. Implies --renewable. Accepts same time syntax as --endtime. If --renewable is specified, the default is 1 week after the start time.. */ 71 char * renew_till_orig; /**< @brief Specify renewable life of ticket. Implies --renewable. Accepts same time syntax as --endtime. If --renewable is specified, the default is 1 week after the start time. original value given at command line. */ 72 const char *renew_till_help; /**< @brief Specify renewable life of ticket. Implies --renewable. Accepts same time syntax as --endtime. If --renewable is specified, the default is 1 week after the start time. help description. */ 73 char * server_name_arg; /**< @brief Server name. Default is 'krbtgt/REALM' where REALM is client realm.. */ 74 char * server_name_orig; /**< @brief Server name. Default is 'krbtgt/REALM' where REALM is client realm. original value given at command line. */ 75 const char *server_name_help; /**< @brief Server name. Default is 'krbtgt/REALM' where REALM is client realm. help description. */ 76 char * starttime_arg; /**< @brief Specify when ticket should start to be valid. Accepts same time syntax as --endtime. The default is to become valid immediately.. */ 77 char * starttime_orig; /**< @brief Specify when ticket should start to be valid. Accepts same time syntax as --endtime. The default is to become valid immediately. original value given at command line. */ 78 const char *starttime_help; /**< @brief Specify when ticket should start to be valid. Accepts same time syntax as --endtime. The default is to become valid immediately. help description. */ 79 char * ticket_granter_arg; /**< @brief Service name in ticket to use for authenticating request. Only for TGS. Defaults to 'krbtgt/REALM@REALM' where REALM is client realm.. */ 80 char * ticket_granter_orig; /**< @brief Service name in ticket to use for authenticating request. Only for TGS. Defaults to 'krbtgt/REALM@REALM' where REALM is client realm. original value given at command line. */ 81 const char *ticket_granter_help; /**< @brief Service name in ticket to use for authenticating request. Only for TGS. Defaults to 'krbtgt/REALM@REALM' where REALM is client realm. help description. */ 82 char * configuration_file_arg; /**< @brief Read user configuration from FILE.. */ 83 char * configuration_file_orig; /**< @brief Read user configuration from FILE. original value given at command line. */ 84 const char *configuration_file_help; /**< @brief Read user configuration from FILE. help description. */ 85 char * ticket_file_arg; /**< @brief Read tickets from FILE.. */ 86 char * ticket_file_orig; /**< @brief Read tickets from FILE. original value given at command line. */ 87 const char *ticket_file_help; /**< @brief Read tickets from FILE. help description. */ 88 char * library_options_arg; /**< @brief Parse STRING as a configuration file statement.. */ 89 char * library_options_orig; /**< @brief Parse STRING as a configuration file statement. original value given at command line. */ 90 const char *library_options_help; /**< @brief Parse STRING as a configuration file statement. help description. */ 91 int quiet_flag; /**< @brief Don't produce any diagnostic output. 92 (default=off). */ 93 const char *quiet_help; /**< @brief Don't produce any diagnostic output. 94 help description. */ 95 char * system_configuration_file_arg; /**< @brief Read system configuration from FILE.. */ 96 char * system_configuration_file_orig; /**< @brief Read system configuration from FILE. original value given at command line. */ 97 const char *system_configuration_file_help; /**< @brief Read system configuration from FILE. help description. */ 98 char * ticket_write_file_arg; /**< @brief Write tickets from FILE. Default is to write them back to where they were read from.. */ 99 char * ticket_write_file_orig; /**< @brief Write tickets from FILE. Default is to write them back to where they were read from. original value given at command line. */ 100 const char *ticket_write_file_help; /**< @brief Write tickets from FILE. Default is to write them back to where they were read from. help description. */ 101 unsigned int verbose_min; /**< @brief Produce verbose output. 102 Use multiple times to increase amount of information.'s minimum occurreces */ 103 unsigned int verbose_max; /**< @brief Produce verbose output. 104 Use multiple times to increase amount of information.'s maximum occurreces */ 105 const char *verbose_help; /**< @brief Produce verbose output. 106 Use multiple times to increase amount of information. help description. */ 107 108 unsigned int help_given ; /**< @brief Whether help was given. */ 109 unsigned int version_given ; /**< @brief Whether version was given. */ 110 unsigned int destroy_given ; /**< @brief Whether destroy was given. */ 111 unsigned int list_given ; /**< @brief Whether list was given. */ 112 unsigned int renew_given ; /**< @brief Whether renew was given. */ 113 unsigned int forwardable_given ; /**< @brief Whether forwardable was given. */ 114 unsigned int forwarded_given ; /**< @brief Whether forwarded was given. */ 115 unsigned int proxiable_given ; /**< @brief Whether proxiable was given. */ 116 unsigned int proxy_given ; /**< @brief Whether proxy was given. */ 117 unsigned int renewable_given ; /**< @brief Whether renewable was given. */ 118 unsigned int client_name_given ; /**< @brief Whether client-name was given. */ 119 unsigned int encryption_type_given ; /**< @brief Whether encryption-type was given. */ 120 unsigned int endtime_given ; /**< @brief Whether endtime was given. */ 121 unsigned int realm_given ; /**< @brief Whether realm was given. */ 122 unsigned int renew_till_given ; /**< @brief Whether renew-till was given. */ 123 unsigned int server_name_given ; /**< @brief Whether server-name was given. */ 124 unsigned int starttime_given ; /**< @brief Whether starttime was given. */ 125 unsigned int ticket_granter_given ; /**< @brief Whether ticket-granter was given. */ 126 unsigned int configuration_file_given ; /**< @brief Whether configuration-file was given. */ 127 unsigned int ticket_file_given ; /**< @brief Whether ticket-file was given. */ 128 unsigned int library_options_given ; /**< @brief Whether library-options was given. */ 129 unsigned int quiet_given ; /**< @brief Whether quiet was given. */ 130 unsigned int system_configuration_file_given ; /**< @brief Whether system-configuration-file was given. */ 131 unsigned int ticket_write_file_given ; /**< @brief Whether ticket-write-file was given. */ 132 unsigned int verbose_given ; /**< @brief Whether verbose was given. */ 133 134 char **inputs ; /**< @brief unamed options (options without names) */ 135 unsigned inputs_num ; /**< @brief unamed options number */ 136 } ; 137 138 /** @brief The additional parameters to pass to parser functions */ 139 struct cmdline_parser_params 140 { 141 int override; /**< @brief whether to override possibly already present options (default 0) */ 142 int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */ 143 int check_required; /**< @brief whether to check that all required options were provided (default 1) */ 144 int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */ 145 int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */ 146 } ; 147 148 /** @brief the purpose string of the program */ 149 extern const char *gengetopt_args_info_purpose; 150 /** @brief the usage string of the program */ 151 extern const char *gengetopt_args_info_usage; 152 /** @brief all the lines making the help output */ 153 extern const char *gengetopt_args_info_help[]; 154 155 /** 156 * The command line parser 157 * @param argc the number of command line options 158 * @param argv the command line options 159 * @param args_info the structure where option information will be stored 160 * @return 0 if everything went fine, NON 0 if an error took place 161 */ 162 int cmdline_parser (int argc, char **argv, 163 struct gengetopt_args_info *args_info); 164 165 /** 166 * The command line parser (version with additional parameters - deprecated) 167 * @param argc the number of command line options 168 * @param argv the command line options 169 * @param args_info the structure where option information will be stored 170 * @param override whether to override possibly already present options 171 * @param initialize whether to initialize the option structure my_args_info 172 * @param check_required whether to check that all required options were provided 173 * @return 0 if everything went fine, NON 0 if an error took place 174 * @deprecated use cmdline_parser_ext() instead 175 */ 176 int cmdline_parser2 (int argc, char **argv, 177 struct gengetopt_args_info *args_info, 178 int override, int initialize, int check_required); 179 180 /** 181 * The command line parser (version with additional parameters) 182 * @param argc the number of command line options 183 * @param argv the command line options 184 * @param args_info the structure where option information will be stored 185 * @param params additional parameters for the parser 186 * @return 0 if everything went fine, NON 0 if an error took place 187 */ 188 int cmdline_parser_ext (int argc, char **argv, 189 struct gengetopt_args_info *args_info, 190 struct cmdline_parser_params *params); 191 192 /** 193 * Save the contents of the option struct into an already open FILE stream. 194 * @param outfile the stream where to dump options 195 * @param args_info the option struct to dump 196 * @return 0 if everything went fine, NON 0 if an error took place 197 */ 198 int cmdline_parser_dump(FILE *outfile, 199 struct gengetopt_args_info *args_info); 200 201 /** 202 * Save the contents of the option struct into a (text) file. 203 * This file can be read by the config file parser (if generated by gengetopt) 204 * @param filename the file where to save 205 * @param args_info the option struct to save 206 * @return 0 if everything went fine, NON 0 if an error took place 207 */ 208 int cmdline_parser_file_save(const char *filename, 209 struct gengetopt_args_info *args_info); 210 211 /** 212 * Print the help 213 */ 214 void cmdline_parser_print_help(void); 215 /** 216 * Print the version 217 */ 218 void cmdline_parser_print_version(void); 219 220 /** 221 * Initializes all the fields a cmdline_parser_params structure 222 * to their default values 223 * @param params the structure to initialize 224 */ 225 void cmdline_parser_params_init(struct cmdline_parser_params *params); 226 227 /** 228 * Allocates dynamically a cmdline_parser_params structure and initializes 229 * all its fields to their default values 230 * @return the created and initialized cmdline_parser_params structure 231 */ 232 struct cmdline_parser_params *cmdline_parser_params_create(void); 233 234 /** 235 * Initializes the passed gengetopt_args_info structure's fields 236 * (also set default values for options that have a default) 237 * @param args_info the structure to initialize 238 */ 239 void cmdline_parser_init (struct gengetopt_args_info *args_info); 240 /** 241 * Deallocates the string fields of the gengetopt_args_info structure 242 * (but does not deallocate the structure itself) 243 * @param args_info the structure to deallocate 244 */ 245 void cmdline_parser_free (struct gengetopt_args_info *args_info); 246 247 /** 248 * Checks that all the required options were specified 249 * @param args_info the structure to check 250 * @param prog_name the name of the program that will be used to print 251 * possible errors 252 * @return 253 */ 254 int cmdline_parser_required (struct gengetopt_args_info *args_info, 255 const char *prog_name); 256 257 258 #ifdef __cplusplus 259 } 260 #endif /* __cplusplus */ 261 #endif /* SHISHI_CMD_H */ 262