blob: b93fa0ba04e2d5705ef3d4e8e1998ee99bc20052 [file] [log] [blame]
Harald Weltef6214982017-09-24 10:23:24 +08001/** @file cmdline.h
2 * @brief The header file for the command line option parser
3 * generated by GNU Gengetopt version 2.22.6
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 */
jjako52c24142002-12-16 13:33:51 +00007
Harald Welte1b3e5772010-05-04 11:13:56 +02008#ifndef CMDLINE_H
9#define CMDLINE_H
10
11/* If we use autoconf. */
12#ifdef HAVE_CONFIG_H
13#include "config.h"
14#endif
jjako52c24142002-12-16 13:33:51 +000015
Harald Weltef6214982017-09-24 10:23:24 +080016#include <stdio.h> /* for FILE */
17
jjako52c24142002-12-16 13:33:51 +000018#ifdef __cplusplus
19extern "C" {
Harald Weltebed35df2011-11-02 13:06:18 +010020#endif /* __cplusplus */
jjako52c24142002-12-16 13:33:51 +000021
Harald Welte1b3e5772010-05-04 11:13:56 +020022#ifndef CMDLINE_PARSER_PACKAGE
Harald Weltef6214982017-09-24 10:23:24 +080023/** @brief the program name (used for printing errors) */
Harald Welte7e1175f2017-09-24 10:53:53 +080024#define CMDLINE_PARSER_PACKAGE "sgsnemu"
jjako52c24142002-12-16 13:33:51 +000025#endif
26
Harald Weltef6214982017-09-24 10:23:24 +080027#ifndef CMDLINE_PARSER_PACKAGE_NAME
28/** @brief the complete program name (used for help and version) */
Harald Welte7e1175f2017-09-24 10:53:53 +080029#define CMDLINE_PARSER_PACKAGE_NAME "sgsnemu"
Harald Weltef6214982017-09-24 10:23:24 +080030#endif
31
Harald Welte1b3e5772010-05-04 11:13:56 +020032#ifndef CMDLINE_PARSER_VERSION
Harald Weltef6214982017-09-24 10:23:24 +080033/** @brief the program version */
Harald Welte1b3e5772010-05-04 11:13:56 +020034#define CMDLINE_PARSER_VERSION VERSION
jjako52c24142002-12-16 13:33:51 +000035#endif
36
Harald Weltef6214982017-09-24 10:23:24 +080037/** @brief Where the command line options are stored */
Harald Weltebed35df2011-11-02 13:06:18 +010038 struct gengetopt_args_info {
Harald Weltef6214982017-09-24 10:23:24 +080039 const char *help_help;
40 /**< @brief Print help and exit help description. */
41 const char *version_help;
42 /**< @brief Print version and exit help description. */
43 int debug_flag;
44 /**< @brief Run in debug mode (default=off). */
45 const char *debug_help;
46 /**< @brief Run in debug mode help description. */
47 char *conf_arg;
48 /**< @brief Read configuration file. */
49 char *conf_orig;
50 /**< @brief Read configuration file original value given at command line. */
51 const char *conf_help;
52 /**< @brief Read configuration file help description. */
53 char *pidfile_arg;
54 /**< @brief Filename of process id file (default='./sgsnemu.pid'). */
55 char *pidfile_orig;
56 /**< @brief Filename of process id file original value given at command line. */
57 const char *pidfile_help;
58 /**< @brief Filename of process id file help description. */
59 char *statedir_arg;
60 /**< @brief Directory of nonvolatile data (default='./'). */
61 char *statedir_orig;
62 /**< @brief Directory of nonvolatile data original value given at command line. */
63 const char *statedir_help;
64 /**< @brief Directory of nonvolatile data help description. */
65 char *dns_arg;
66 /**< @brief DNS Server to use. */
67 char *dns_orig;
68 /**< @brief DNS Server to use original value given at command line. */
69 const char *dns_help;
70 /**< @brief DNS Server to use help description. */
71 char *listen_arg;
72 /**< @brief Local interface. */
73 char *listen_orig;
74 /**< @brief Local interface original value given at command line. */
75 const char *listen_help;
76 /**< @brief Local interface help description. */
77 char *remote_arg;
78 /**< @brief Remote host. */
79 char *remote_orig;
80 /**< @brief Remote host original value given at command line. */
81 const char *remote_help;
82 /**< @brief Remote host help description. */
83 int contexts_arg;
84 /**< @brief Number of contexts (default='1'). */
85 char *contexts_orig;
86 /**< @brief Number of contexts original value given at command line. */
87 const char *contexts_help;
88 /**< @brief Number of contexts help description. */
89 int timelimit_arg;
90 /**< @brief Exit after timelimit seconds (default='0'). */
91 char *timelimit_orig;
92 /**< @brief Exit after timelimit seconds original value given at command line. */
93 const char *timelimit_help;
94 /**< @brief Exit after timelimit seconds help description. */
95 int gtpversion_arg;
96 /**< @brief GTP version to use (default='1'). */
97 char *gtpversion_orig;
98 /**< @brief GTP version to use original value given at command line. */
99 const char *gtpversion_help;
100 /**< @brief GTP version to use help description. */
101 char *apn_arg;
102 /**< @brief Access point name (default='internet'). */
103 char *apn_orig;
104 /**< @brief Access point name original value given at command line. */
105 const char *apn_help;
106 /**< @brief Access point name help description. */
107 int selmode_arg;
108 /**< @brief Selection mode (default='0x01'). */
109 char *selmode_orig;
110 /**< @brief Selection mode original value given at command line. */
111 const char *selmode_help;
112 /**< @brief Selection mode help description. */
113 int rattype_arg;
114 /**< @brief Radio Access Technology Type (default='1'). */
Harald Weltebed35df2011-11-02 13:06:18 +0100115 char *rattype_orig;
Harald Weltef6214982017-09-24 10:23:24 +0800116 /**< @brief Radio Access Technology Type original value given at command line. */
117 const char *rattype_help;
118 /**< @brief Radio Access Technology Type help description. */
119 char *userloc_arg;
120 /**< @brief User Location Information (default='02509946241207'). */
Harald Weltebed35df2011-11-02 13:06:18 +0100121 char *userloc_orig;
Harald Weltef6214982017-09-24 10:23:24 +0800122 /**< @brief User Location Information original value given at command line. */
123 const char *userloc_help;
124 /**< @brief User Location Information help description. */
125 char *rai_arg;
126 /**< @brief Routing Area Information (default='02509946241207'). */
Harald Weltebed35df2011-11-02 13:06:18 +0100127 char *rai_orig;
Harald Weltef6214982017-09-24 10:23:24 +0800128 /**< @brief Routing Area Information original value given at command line. */
129 const char *rai_help;
130 /**< @brief Routing Area Information help description. */
131 char *mstz_arg;
132 /**< @brief MS Time Zone (default='0'). */
Harald Weltebed35df2011-11-02 13:06:18 +0100133 char *mstz_orig;
Harald Weltef6214982017-09-24 10:23:24 +0800134 /**< @brief MS Time Zone original value given at command line. */
135 const char *mstz_help;
136 /**< @brief MS Time Zone help description. */
137 char *imeisv_arg;
138 /**< @brief IMEI(SV) International Mobile Equipment Identity (and Software Version) (default='2143658709214365'). */
Harald Weltebed35df2011-11-02 13:06:18 +0100139 char *imeisv_orig;
Harald Weltef6214982017-09-24 10:23:24 +0800140 /**< @brief IMEI(SV) International Mobile Equipment Identity (and Software Version) original value given at command line. */
141 const char *imeisv_help;
142 /**< @brief IMEI(SV) International Mobile Equipment Identity (and Software Version) help description. */
143 int norecovery_flag;
144 /**< @brief Do not send recovery (default=off). */
145 const char *norecovery_help;
146 /**< @brief Do not send recovery help description. */
147 char *imsi_arg;
148 /**< @brief IMSI (default='240010123456789'). */
149 char *imsi_orig;
150 /**< @brief IMSI original value given at command line. */
151 const char *imsi_help;
152 /**< @brief IMSI help description. */
153 int nsapi_arg;
154 /**< @brief NSAPI (default='0'). */
155 char *nsapi_orig;
156 /**< @brief NSAPI original value given at command line. */
157 const char *nsapi_help;
158 /**< @brief NSAPI help description. */
159 char *msisdn_arg;
160 /**< @brief Mobile Station ISDN number (default='46702123456'). */
161 char *msisdn_orig;
162 /**< @brief Mobile Station ISDN number original value given at command line. */
163 const char *msisdn_help;
164 /**< @brief Mobile Station ISDN number help description. */
165 int qos_arg;
166 /**< @brief Requested quality of service (default='0x000b921f'). */
167 char *qos_orig;
168 /**< @brief Requested quality of service original value given at command line. */
169 const char *qos_help;
170 /**< @brief Requested quality of service help description. */
171 unsigned long long int qose1_arg;
172 /**< @brief Requested quality of service Extension 1 (default='0x9396404074f9ffff'). */
173 char *qose1_orig;
174 /**< @brief Requested quality of service Extension 1 original value given at command line. */
175 const char *qose1_help;
176 /**< @brief Requested quality of service Extension 1 help description. */
177 int qose2_arg;
178 /**< @brief Requested quality of service Extension 2 (default='0x11'). */
179 char *qose2_orig;
180 /**< @brief Requested quality of service Extension 2 original value given at command line. */
181 const char *qose2_help;
182 /**< @brief Requested quality of service Extension 2 help description. */
183 int qose3_arg;
184 /**< @brief Requested quality of service Extension 3 (default='0x0101'). */
185 char *qose3_orig;
186 /**< @brief Requested quality of service Extension 3 original value given at command line. */
187 const char *qose3_help;
188 /**< @brief Requested quality of service Extension 3 help description. */
189 int qose4_arg;
190 /**< @brief Requested quality of service Extension 4 (default='0x4040'). */
191 char *qose4_orig;
192 /**< @brief Requested quality of service Extension 4 original value given at command line. */
193 const char *qose4_help;
194 /**< @brief Requested quality of service Extension 4 help description. */
195 int charging_arg;
196 /**< @brief Charging characteristics (default='0x0800'). */
197 char *charging_orig;
198 /**< @brief Charging characteristics original value given at command line. */
199 const char *charging_help;
200 /**< @brief Charging characteristics help description. */
201 char *uid_arg;
202 /**< @brief Login user ID (default='mig'). */
203 char *uid_orig;
204 /**< @brief Login user ID original value given at command line. */
205 const char *uid_help;
206 /**< @brief Login user ID help description. */
207 char *pwd_arg;
208 /**< @brief Login password (default='hemmelig'). */
209 char *pwd_orig;
210 /**< @brief Login password original value given at command line. */
211 const char *pwd_help;
212 /**< @brief Login password help description. */
213 int createif_flag;
214 /**< @brief Create local network interface (default=off). */
215 const char *createif_help;
216 /**< @brief Create local network interface help description. */
217 char *net_arg;
218 /**< @brief Network address for local interface. */
219 char *net_orig;
220 /**< @brief Network address for local interface original value given at command line. */
221 const char *net_help;
222 /**< @brief Network address for local interface help description. */
223 int defaultroute_flag;
224 /**< @brief Create default route (default=off). */
225 const char *defaultroute_help;
226 /**< @brief Create default route help description. */
227 char *ipup_arg;
228 /**< @brief Script to run after link-up. */
229 char *ipup_orig;
230 /**< @brief Script to run after link-up original value given at command line. */
231 const char *ipup_help;
232 /**< @brief Script to run after link-up help description. */
233 char *ipdown_arg;
234 /**< @brief Script to run after link-down. */
235 char *ipdown_orig;
236 /**< @brief Script to run after link-down original value given at command line. */
237 const char *ipdown_help;
238 /**< @brief Script to run after link-down help description. */
239 char *pinghost_arg;
240 /**< @brief Ping remote host. */
241 char *pinghost_orig;
242 /**< @brief Ping remote host original value given at command line. */
243 const char *pinghost_help;
244 /**< @brief Ping remote host help description. */
245 int pingrate_arg;
246 /**< @brief Number of ping req per second (default='1'). */
247 char *pingrate_orig;
248 /**< @brief Number of ping req per second original value given at command line. */
249 const char *pingrate_help;
250 /**< @brief Number of ping req per second help description. */
251 int pingsize_arg;
252 /**< @brief Number of ping data bytes (default='56'). */
253 char *pingsize_orig;
254 /**< @brief Number of ping data bytes original value given at command line. */
255 const char *pingsize_help;
256 /**< @brief Number of ping data bytes help description. */
257 int pingcount_arg;
258 /**< @brief Number of ping req to send (default='0'). */
259 char *pingcount_orig;
260 /**< @brief Number of ping req to send original value given at command line. */
261 const char *pingcount_help;
262 /**< @brief Number of ping req to send help description. */
263 int pingquiet_flag;
264 /**< @brief Do not print ping packet info (default=off). */
265 const char *pingquiet_help;
266 /**< @brief Do not print ping packet info help description. */
jjako52c24142002-12-16 13:33:51 +0000267
Harald Weltef6214982017-09-24 10:23:24 +0800268 unsigned int help_given;
269 /**< @brief Whether help was given. */
270 unsigned int version_given;
271 /**< @brief Whether version was given. */
272 unsigned int debug_given;
273 /**< @brief Whether debug was given. */
274 unsigned int conf_given;
275 /**< @brief Whether conf was given. */
276 unsigned int pidfile_given;
277 /**< @brief Whether pidfile was given. */
278 unsigned int statedir_given;
279 /**< @brief Whether statedir was given. */
280 unsigned int dns_given;
281 /**< @brief Whether dns was given. */
282 unsigned int listen_given;
283 /**< @brief Whether listen was given. */
284 unsigned int remote_given;
285 /**< @brief Whether remote was given. */
286 unsigned int contexts_given;
287 /**< @brief Whether contexts was given. */
288 unsigned int timelimit_given;
289 /**< @brief Whether timelimit was given. */
290 unsigned int gtpversion_given;
291 /**< @brief Whether gtpversion was given. */
292 unsigned int apn_given;
293 /**< @brief Whether apn was given. */
294 unsigned int selmode_given;
295 /**< @brief Whether selmode was given. */
296 unsigned int rattype_given;
297 /**< @brief Whether rattype was given. */
298 unsigned int userloc_given;
299 /**< @brief Whether userloc was given. */
300 unsigned int rai_given;
301 /**< @brief Whether rai was given. */
302 unsigned int mstz_given;
303 /**< @brief Whether mstz was given. */
304 unsigned int imeisv_given;
305 /**< @brief Whether imeisv was given. */
306 unsigned int norecovery_given;
307 /**< @brief Whether norecovery was given. */
308 unsigned int imsi_given;
309 /**< @brief Whether imsi was given. */
310 unsigned int nsapi_given;
311 /**< @brief Whether nsapi was given. */
312 unsigned int msisdn_given;
313 /**< @brief Whether msisdn was given. */
314 unsigned int qos_given;
315 /**< @brief Whether qos was given. */
316 unsigned int qose1_given;
317 /**< @brief Whether qose1 was given. */
318 unsigned int qose2_given;
319 /**< @brief Whether qose2 was given. */
320 unsigned int qose3_given;
321 /**< @brief Whether qose3 was given. */
322 unsigned int qose4_given;
323 /**< @brief Whether qose4 was given. */
324 unsigned int charging_given;
325 /**< @brief Whether charging was given. */
326 unsigned int uid_given;
327 /**< @brief Whether uid was given. */
328 unsigned int pwd_given;
329 /**< @brief Whether pwd was given. */
330 unsigned int createif_given;
331 /**< @brief Whether createif was given. */
332 unsigned int net_given;
333 /**< @brief Whether net was given. */
334 unsigned int defaultroute_given;
335 /**< @brief Whether defaultroute was given. */
336 unsigned int ipup_given;
337 /**< @brief Whether ipup was given. */
338 unsigned int ipdown_given;
339 /**< @brief Whether ipdown was given. */
340 unsigned int pinghost_given;
341 /**< @brief Whether pinghost was given. */
342 unsigned int pingrate_given;
343 /**< @brief Whether pingrate was given. */
344 unsigned int pingsize_given;
345 /**< @brief Whether pingsize was given. */
346 unsigned int pingcount_given;
347 /**< @brief Whether pingcount was given. */
348 unsigned int pingquiet_given;
349 /**< @brief Whether pingquiet was given. */
jjako52c24142002-12-16 13:33:51 +0000350
Harald Weltebed35df2011-11-02 13:06:18 +0100351 };
Harald Welte1b3e5772010-05-04 11:13:56 +0200352
Harald Weltef6214982017-09-24 10:23:24 +0800353/** @brief The additional parameters to pass to parser functions */
354 struct cmdline_parser_params {
355 int override;
356 /**< @brief whether to override possibly already present options (default 0) */
357 int initialize;
358 /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */
359 int check_required;
360 /**< @brief whether to check that all required options were provided (default 1) */
361 int check_ambiguity;
362 /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */
363 int print_errors;
364 /**< @brief whether getopt_long should print an error message for a bad option (default 1) */
365 };
366
367/** @brief the purpose string of the program */
Harald Weltebed35df2011-11-02 13:06:18 +0100368 extern const char *gengetopt_args_info_purpose;
Harald Weltef6214982017-09-24 10:23:24 +0800369/** @brief the usage string of the program */
Harald Weltebed35df2011-11-02 13:06:18 +0100370 extern const char *gengetopt_args_info_usage;
Harald Weltef6214982017-09-24 10:23:24 +0800371/** @brief the description string of the program */
372 extern const char *gengetopt_args_info_description;
373/** @brief all the lines making the help output */
Harald Weltebed35df2011-11-02 13:06:18 +0100374 extern const char *gengetopt_args_info_help[];
jjako52c24142002-12-16 13:33:51 +0000375
Harald Weltef6214982017-09-24 10:23:24 +0800376/**
377 * The command line parser
378 * @param argc the number of command line options
379 * @param argv the command line options
380 * @param args_info the structure where option information will be stored
381 * @return 0 if everything went fine, NON 0 if an error took place
382 */
383 int cmdline_parser(int argc, char **argv,
Harald Weltebed35df2011-11-02 13:06:18 +0100384 struct gengetopt_args_info *args_info);
Harald Weltef6214982017-09-24 10:23:24 +0800385
386/**
387 * The command line parser (version with additional parameters - deprecated)
388 * @param argc the number of command line options
389 * @param argv the command line options
390 * @param args_info the structure where option information will be stored
391 * @param override whether to override possibly already present options
392 * @param initialize whether to initialize the option structure my_args_info
393 * @param check_required whether to check that all required options were provided
394 * @return 0 if everything went fine, NON 0 if an error took place
395 * @deprecated use cmdline_parser_ext() instead
396 */
397 int cmdline_parser2(int argc, char **argv,
Harald Weltebed35df2011-11-02 13:06:18 +0100398 struct gengetopt_args_info *args_info,
399 int override, int initialize, int check_required);
Harald Weltef6214982017-09-24 10:23:24 +0800400
401/**
402 * The command line parser (version with additional parameters)
403 * @param argc the number of command line options
404 * @param argv the command line options
405 * @param args_info the structure where option information will be stored
406 * @param params additional parameters for the parser
407 * @return 0 if everything went fine, NON 0 if an error took place
408 */
409 int cmdline_parser_ext(int argc, char **argv,
410 struct gengetopt_args_info *args_info,
411 struct cmdline_parser_params *params);
412
413/**
414 * Save the contents of the option struct into an already open FILE stream.
415 * @param outfile the stream where to dump options
416 * @param args_info the option struct to dump
417 * @return 0 if everything went fine, NON 0 if an error took place
418 */
419 int cmdline_parser_dump(FILE * outfile,
420 struct gengetopt_args_info *args_info);
421
422/**
423 * Save the contents of the option struct into a (text) file.
424 * This file can be read by the config file parser (if generated by gengetopt)
425 * @param filename the file where to save
426 * @param args_info the option struct to save
427 * @return 0 if everything went fine, NON 0 if an error took place
428 */
Harald Weltebed35df2011-11-02 13:06:18 +0100429 int cmdline_parser_file_save(const char *filename,
430 struct gengetopt_args_info *args_info);
jjako52c24142002-12-16 13:33:51 +0000431
Harald Weltef6214982017-09-24 10:23:24 +0800432/**
433 * Print the help
434 */
Harald Weltebed35df2011-11-02 13:06:18 +0100435 void cmdline_parser_print_help(void);
Harald Weltef6214982017-09-24 10:23:24 +0800436/**
437 * Print the version
438 */
Harald Weltebed35df2011-11-02 13:06:18 +0100439 void cmdline_parser_print_version(void);
Harald Welte1b3e5772010-05-04 11:13:56 +0200440
Harald Weltef6214982017-09-24 10:23:24 +0800441/**
442 * Initializes all the fields a cmdline_parser_params structure
443 * to their default values
444 * @param params the structure to initialize
445 */
446 void cmdline_parser_params_init(struct cmdline_parser_params *params);
447
448/**
449 * Allocates dynamically a cmdline_parser_params structure and initializes
450 * all its fields to their default values
451 * @return the created and initialized cmdline_parser_params structure
452 */
453 struct cmdline_parser_params *cmdline_parser_params_create(void);
454
455/**
456 * Initializes the passed gengetopt_args_info structure's fields
457 * (also set default values for options that have a default)
458 * @param args_info the structure to initialize
459 */
Harald Weltebed35df2011-11-02 13:06:18 +0100460 void cmdline_parser_init(struct gengetopt_args_info *args_info);
Harald Weltef6214982017-09-24 10:23:24 +0800461/**
462 * Deallocates the string fields of the gengetopt_args_info structure
463 * (but does not deallocate the structure itself)
464 * @param args_info the structure to deallocate
465 */
Harald Weltebed35df2011-11-02 13:06:18 +0100466 void cmdline_parser_free(struct gengetopt_args_info *args_info);
Harald Welte1b3e5772010-05-04 11:13:56 +0200467
Harald Weltef6214982017-09-24 10:23:24 +0800468/**
469 * The config file parser (deprecated version)
470 * @param filename the name of the config file
471 * @param args_info the structure where option information will be stored
472 * @param override whether to override possibly already present options
473 * @param initialize whether to initialize the option structure my_args_info
474 * @param check_required whether to check that all required options were provided
475 * @return 0 if everything went fine, NON 0 if an error took place
476 * @deprecated use cmdline_parser_config_file() instead
477 */
478 int cmdline_parser_configfile(const char *filename,
Harald Weltebed35df2011-11-02 13:06:18 +0100479 struct gengetopt_args_info *args_info,
480 int override, int initialize,
481 int check_required);
Harald Welte1b3e5772010-05-04 11:13:56 +0200482
Harald Weltef6214982017-09-24 10:23:24 +0800483/**
484 * The config file parser
485 * @param filename the name of the config file
486 * @param args_info the structure where option information will be stored
487 * @param params additional parameters for the parser
488 * @return 0 if everything went fine, NON 0 if an error took place
489 */
490 int cmdline_parser_config_file(const char *filename,
491 struct gengetopt_args_info *args_info,
492 struct cmdline_parser_params *params);
493
494/**
495 * Checks that all the required options were specified
496 * @param args_info the structure to check
497 * @param prog_name the name of the program that will be used to print
498 * possible errors
499 * @return
500 */
Harald Weltebed35df2011-11-02 13:06:18 +0100501 int cmdline_parser_required(struct gengetopt_args_info *args_info,
502 const char *prog_name);
jjako52c24142002-12-16 13:33:51 +0000503
504#ifdef __cplusplus
505}
Harald Weltebed35df2011-11-02 13:06:18 +0100506#endif /* __cplusplus */
507#endif /* CMDLINE_H */