1 /** @file cmdline.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 CMDLINE_H
9 #define CMDLINE_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 "quvi"
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 "quvi"
30 #endif
31 
32 #ifndef CMDLINE_PARSER_VERSION
33 /** @brief the program version */
34 #define CMDLINE_PARSER_VERSION ""
35 #endif
36 
37 enum enum_verbosity { verbosity__NULL = -1, verbosity_arg_debug = 0, verbosity_arg_verbose, verbosity_arg_quiet, verbosity_arg_mute };
38 enum enum_category { category__NULL = -1, category_arg_http = 0, category_arg_mms, category_arg_rtsp, category_arg_rtmp, category_arg_all };
39 enum enum_export_format { export_format__NULL = -1, export_format_arg_json = 0, export_format_arg_xml };
40 enum enum_export_level { export_level__NULL = -1, export_level_arg_media = 0, export_level_arg_PLUS_errors };
41 enum enum_feature { feature__NULL = -1, feature_arg_resolve = 0, feature_arg_MINUS_resolve, feature_arg_verify, feature_arg_MINUS_verify, feature_arg_proxy, feature_arg_MINUS_proxy };
42 
43 /** @brief Where the command line options are stored */
44 struct gengetopt_args_info
45 {
46   const char *help_help; /**< @brief Print help and exit help description.  */
47   const char *version_help; /**< @brief Print version and exit help description.  */
48   const char *license_help; /**< @brief Print license and exit help description.  */
49   const char *support_help; /**< @brief Print supported websites and exit help description.  */
50   const char *query_formats_help; /**< @brief Query available formats to URL help description.  */
51   char * agent_arg;	/**< @brief Identify as (default='Mozilla/5.0').  */
52   char * agent_orig;	/**< @brief Identify as original value given at command line.  */
53   const char *agent_help; /**< @brief Identify as help description.  */
54   char * proxy_arg;	/**< @brief Use proxy with HTTP connections.  */
55   char * proxy_orig;	/**< @brief Use proxy with HTTP connections original value given at command line.  */
56   const char *proxy_help; /**< @brief Use proxy with HTTP connections help description.  */
57   int connect_timeout_arg;	/**< @brief Seconds connecting allowed to take (default='30').  */
58   char * connect_timeout_orig;	/**< @brief Seconds connecting allowed to take original value given at command line.  */
59   const char *connect_timeout_help; /**< @brief Seconds connecting allowed to take help description.  */
60   char ** exec_arg;	/**< @brief Execute command when done parsing.  */
61   char ** exec_orig;	/**< @brief Execute command when done parsing original value given at command line.  */
62   unsigned int exec_min; /**< @brief Execute command when done parsing's minimum occurreces */
63   unsigned int exec_max; /**< @brief Execute command when done parsing's maximum occurreces */
64   const char *exec_help; /**< @brief Execute command when done parsing help description.  */
65   char * format_arg;	/**< @brief Query for format of media (default='default').  */
66   char * format_orig;	/**< @brief Query for format of media original value given at command line.  */
67   const char *format_help; /**< @brief Query for format of media help description.  */
68   enum enum_verbosity verbosity_arg;	/**< @brief Verbosity level of printed messages (default='verbose').  */
69   char * verbosity_orig;	/**< @brief Verbosity level of printed messages original value given at command line.  */
70   const char *verbosity_help; /**< @brief Verbosity level of printed messages help description.  */
71   enum enum_category *category_arg;	/**< @brief Level of libquvi scripts to enable (default='all').  */
72   char ** category_orig;	/**< @brief Level of libquvi scripts to enable original value given at command line.  */
73   unsigned int category_min; /**< @brief Level of libquvi scripts to enable's minimum occurreces */
74   unsigned int category_max; /**< @brief Level of libquvi scripts to enable's maximum occurreces */
75   const char *category_help; /**< @brief Level of libquvi scripts to enable help description.  */
76   enum enum_export_format export_format_arg;	/**< @brief Export in data interchange format (default='json').  */
77   char * export_format_orig;	/**< @brief Export in data interchange format original value given at command line.  */
78   const char *export_format_help; /**< @brief Export in data interchange format help description.  */
79   enum enum_export_level export_level_arg;	/**< @brief Level of exported data (default='media').  */
80   char * export_level_orig;	/**< @brief Level of exported data original value given at command line.  */
81   const char *export_level_help; /**< @brief Level of exported data help description.  */
82   enum enum_feature *feature_arg;	/**< @brief Enable (or disable) feature.  */
83   char ** feature_orig;	/**< @brief Enable (or disable) feature original value given at command line.  */
84   unsigned int feature_min; /**< @brief Enable (or disable) feature's minimum occurreces */
85   unsigned int feature_max; /**< @brief Enable (or disable) feature's maximum occurreces */
86   const char *feature_help; /**< @brief Enable (or disable) feature help description.  */
87   const char *category_all_help; /**< @brief All website script categories help description.  */
88   const char *category_http_help; /**< @brief Category HTTP website scripts help description.  */
89   const char *category_mms_help; /**< @brief Category MMS website scripts help description.  */
90   const char *category_rtsp_help; /**< @brief Category RTSP website scripts help description.  */
91   const char *category_rtmp_help; /**< @brief Category RTMP website scripts help description.  */
92   const char *xml_help; /**< @brief Print details in XML help description.  */
93   const char *quiet_help; /**< @brief Turn off output to stderr help description.  */
94   const char *verbose_libcurl_help; /**< @brief Turn on libcurl verbose mode help description.  */
95   const char *no_resolve_help; /**< @brief Do not resolve redirections help description.  */
96   const char *no_verify_help; /**< @brief Do not verify media URL help description.  */
97   const char *no_proxy_help; /**< @brief Disable use of HTTP proxy help description.  */
98 
99   unsigned int help_given ;	/**< @brief Whether help was given.  */
100   unsigned int version_given ;	/**< @brief Whether version was given.  */
101   unsigned int license_given ;	/**< @brief Whether license was given.  */
102   unsigned int support_given ;	/**< @brief Whether support was given.  */
103   unsigned int query_formats_given ;	/**< @brief Whether query-formats was given.  */
104   unsigned int agent_given ;	/**< @brief Whether agent was given.  */
105   unsigned int proxy_given ;	/**< @brief Whether proxy was given.  */
106   unsigned int connect_timeout_given ;	/**< @brief Whether connect-timeout was given.  */
107   unsigned int exec_given ;	/**< @brief Whether exec was given.  */
108   unsigned int format_given ;	/**< @brief Whether format was given.  */
109   unsigned int verbosity_given ;	/**< @brief Whether verbosity was given.  */
110   unsigned int category_given ;	/**< @brief Whether category was given.  */
111   unsigned int export_format_given ;	/**< @brief Whether export-format was given.  */
112   unsigned int export_level_given ;	/**< @brief Whether export-level was given.  */
113   unsigned int feature_given ;	/**< @brief Whether feature was given.  */
114   unsigned int category_all_given ;	/**< @brief Whether category-all was given.  */
115   unsigned int category_http_given ;	/**< @brief Whether category-http was given.  */
116   unsigned int category_mms_given ;	/**< @brief Whether category-mms was given.  */
117   unsigned int category_rtsp_given ;	/**< @brief Whether category-rtsp was given.  */
118   unsigned int category_rtmp_given ;	/**< @brief Whether category-rtmp was given.  */
119   unsigned int xml_given ;	/**< @brief Whether xml was given.  */
120   unsigned int quiet_given ;	/**< @brief Whether quiet was given.  */
121   unsigned int verbose_libcurl_given ;	/**< @brief Whether verbose-libcurl was given.  */
122   unsigned int no_resolve_given ;	/**< @brief Whether no-resolve was given.  */
123   unsigned int no_verify_given ;	/**< @brief Whether no-verify was given.  */
124   unsigned int no_proxy_given ;	/**< @brief Whether no-proxy was given.  */
125 
126   char **inputs ; /**< @brief unamed options (options without names) */
127   unsigned inputs_num ; /**< @brief unamed options number */
128 } ;
129 
130 /** @brief The additional parameters to pass to parser functions */
131 struct cmdline_parser_params
132 {
133   int override; /**< @brief whether to override possibly already present options (default 0) */
134   int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */
135   int check_required; /**< @brief whether to check that all required options were provided (default 1) */
136   int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */
137   int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */
138 } ;
139 
140 /** @brief the purpose string of the program */
141 extern const char *gengetopt_args_info_purpose;
142 /** @brief the usage string of the program */
143 extern const char *gengetopt_args_info_usage;
144 /** @brief all the lines making the help output */
145 extern const char *gengetopt_args_info_help[];
146 
147 /**
148  * The command line parser
149  * @param argc the number of command line options
150  * @param argv the command line options
151  * @param args_info the structure where option information will be stored
152  * @return 0 if everything went fine, NON 0 if an error took place
153  */
154 int cmdline_parser (int argc, char **argv,
155   struct gengetopt_args_info *args_info);
156 
157 /**
158  * The command line parser (version with additional parameters - deprecated)
159  * @param argc the number of command line options
160  * @param argv the command line options
161  * @param args_info the structure where option information will be stored
162  * @param override whether to override possibly already present options
163  * @param initialize whether to initialize the option structure my_args_info
164  * @param check_required whether to check that all required options were provided
165  * @return 0 if everything went fine, NON 0 if an error took place
166  * @deprecated use cmdline_parser_ext() instead
167  */
168 int cmdline_parser2 (int argc, char **argv,
169   struct gengetopt_args_info *args_info,
170   int override, int initialize, int check_required);
171 
172 /**
173  * The command line parser (version with additional parameters)
174  * @param argc the number of command line options
175  * @param argv the command line options
176  * @param args_info the structure where option information will be stored
177  * @param params additional parameters for the parser
178  * @return 0 if everything went fine, NON 0 if an error took place
179  */
180 int cmdline_parser_ext (int argc, char **argv,
181   struct gengetopt_args_info *args_info,
182   struct cmdline_parser_params *params);
183 
184 /**
185  * Save the contents of the option struct into an already open FILE stream.
186  * @param outfile the stream where to dump options
187  * @param args_info the option struct to dump
188  * @return 0 if everything went fine, NON 0 if an error took place
189  */
190 int cmdline_parser_dump(FILE *outfile,
191   struct gengetopt_args_info *args_info);
192 
193 /**
194  * Save the contents of the option struct into a (text) file.
195  * This file can be read by the config file parser (if generated by gengetopt)
196  * @param filename the file where to save
197  * @param args_info the option struct to save
198  * @return 0 if everything went fine, NON 0 if an error took place
199  */
200 int cmdline_parser_file_save(const char *filename,
201   struct gengetopt_args_info *args_info);
202 
203 /**
204  * Print the help
205  */
206 void cmdline_parser_print_help(void);
207 /**
208  * Print the version
209  */
210 void cmdline_parser_print_version(void);
211 
212 /**
213  * Initializes all the fields a cmdline_parser_params structure
214  * to their default values
215  * @param params the structure to initialize
216  */
217 void cmdline_parser_params_init(struct cmdline_parser_params *params);
218 
219 /**
220  * Allocates dynamically a cmdline_parser_params structure and initializes
221  * all its fields to their default values
222  * @return the created and initialized cmdline_parser_params structure
223  */
224 struct cmdline_parser_params *cmdline_parser_params_create(void);
225 
226 /**
227  * Initializes the passed gengetopt_args_info structure's fields
228  * (also set default values for options that have a default)
229  * @param args_info the structure to initialize
230  */
231 void cmdline_parser_init (struct gengetopt_args_info *args_info);
232 /**
233  * Deallocates the string fields of the gengetopt_args_info structure
234  * (but does not deallocate the structure itself)
235  * @param args_info the structure to deallocate
236  */
237 void cmdline_parser_free (struct gengetopt_args_info *args_info);
238 
239 /**
240  * The config file parser (deprecated version)
241  * @param filename the name of the config file
242  * @param args_info the structure where option information will be stored
243  * @param override whether to override possibly already present options
244  * @param initialize whether to initialize the option structure my_args_info
245  * @param check_required whether to check that all required options were provided
246  * @return 0 if everything went fine, NON 0 if an error took place
247  * @deprecated use cmdline_parser_config_file() instead
248  */
249 int cmdline_parser_configfile (const char *filename,
250   struct gengetopt_args_info *args_info,
251   int override, int initialize, int check_required);
252 
253 /**
254  * The config file parser
255  * @param filename the name of the config file
256  * @param args_info the structure where option information will be stored
257  * @param params additional parameters for the parser
258  * @return 0 if everything went fine, NON 0 if an error took place
259  */
260 int cmdline_parser_config_file (const char *filename,
261   struct gengetopt_args_info *args_info,
262   struct cmdline_parser_params *params);
263 
264 /**
265  * Checks that all the required options were specified
266  * @param args_info the structure to check
267  * @param prog_name the name of the program that will be used to print
268  *   possible errors
269  * @return
270  */
271 int cmdline_parser_required (struct gengetopt_args_info *args_info,
272   const char *prog_name);
273 
274 extern const char *cmdline_parser_verbosity_values[];  /**< @brief Possible values for verbosity. */
275 extern const char *cmdline_parser_category_values[];  /**< @brief Possible values for category. */
276 extern const char *cmdline_parser_export_format_values[];  /**< @brief Possible values for export-format. */
277 extern const char *cmdline_parser_export_level_values[];  /**< @brief Possible values for export-level. */
278 extern const char *cmdline_parser_feature_values[];  /**< @brief Possible values for feature. */
279 
280 
281 #ifdef __cplusplus
282 }
283 #endif /* __cplusplus */
284 #endif /* CMDLINE_H */
285