blob: 38db7dabb7e8b76df50e30d66b48b5bbfcc4bd0f [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. */
Harald Weltefbb9c7f2017-09-24 11:50:20 +0800267 int no_tx_gpdu_seq_flag;
268 /**< @brief Don't transmit G-PDU sequence nums (default=off). */
269 const char *no_tx_gpdu_seq_help;
270 /**< @brief Don't transmit G-PDU sequence nums help description. */
jjako52c24142002-12-16 13:33:51 +0000271
Harald Weltef6214982017-09-24 10:23:24 +0800272 unsigned int help_given;
273 /**< @brief Whether help was given. */
274 unsigned int version_given;
275 /**< @brief Whether version was given. */
276 unsigned int debug_given;
277 /**< @brief Whether debug was given. */
278 unsigned int conf_given;
279 /**< @brief Whether conf was given. */
280 unsigned int pidfile_given;
281 /**< @brief Whether pidfile was given. */
282 unsigned int statedir_given;
283 /**< @brief Whether statedir was given. */
284 unsigned int dns_given;
285 /**< @brief Whether dns was given. */
286 unsigned int listen_given;
287 /**< @brief Whether listen was given. */
288 unsigned int remote_given;
289 /**< @brief Whether remote was given. */
290 unsigned int contexts_given;
291 /**< @brief Whether contexts was given. */
292 unsigned int timelimit_given;
293 /**< @brief Whether timelimit was given. */
294 unsigned int gtpversion_given;
295 /**< @brief Whether gtpversion was given. */
296 unsigned int apn_given;
297 /**< @brief Whether apn was given. */
298 unsigned int selmode_given;
299 /**< @brief Whether selmode was given. */
300 unsigned int rattype_given;
301 /**< @brief Whether rattype was given. */
302 unsigned int userloc_given;
303 /**< @brief Whether userloc was given. */
304 unsigned int rai_given;
305 /**< @brief Whether rai was given. */
306 unsigned int mstz_given;
307 /**< @brief Whether mstz was given. */
308 unsigned int imeisv_given;
309 /**< @brief Whether imeisv was given. */
310 unsigned int norecovery_given;
311 /**< @brief Whether norecovery was given. */
312 unsigned int imsi_given;
313 /**< @brief Whether imsi was given. */
314 unsigned int nsapi_given;
315 /**< @brief Whether nsapi was given. */
316 unsigned int msisdn_given;
317 /**< @brief Whether msisdn was given. */
318 unsigned int qos_given;
319 /**< @brief Whether qos was given. */
320 unsigned int qose1_given;
321 /**< @brief Whether qose1 was given. */
322 unsigned int qose2_given;
323 /**< @brief Whether qose2 was given. */
324 unsigned int qose3_given;
325 /**< @brief Whether qose3 was given. */
326 unsigned int qose4_given;
327 /**< @brief Whether qose4 was given. */
328 unsigned int charging_given;
329 /**< @brief Whether charging was given. */
330 unsigned int uid_given;
331 /**< @brief Whether uid was given. */
332 unsigned int pwd_given;
333 /**< @brief Whether pwd was given. */
334 unsigned int createif_given;
335 /**< @brief Whether createif was given. */
336 unsigned int net_given;
337 /**< @brief Whether net was given. */
338 unsigned int defaultroute_given;
339 /**< @brief Whether defaultroute was given. */
340 unsigned int ipup_given;
341 /**< @brief Whether ipup was given. */
342 unsigned int ipdown_given;
343 /**< @brief Whether ipdown was given. */
344 unsigned int pinghost_given;
345 /**< @brief Whether pinghost was given. */
346 unsigned int pingrate_given;
347 /**< @brief Whether pingrate was given. */
348 unsigned int pingsize_given;
349 /**< @brief Whether pingsize was given. */
350 unsigned int pingcount_given;
351 /**< @brief Whether pingcount was given. */
352 unsigned int pingquiet_given;
353 /**< @brief Whether pingquiet was given. */
Harald Weltefbb9c7f2017-09-24 11:50:20 +0800354 unsigned int no_tx_gpdu_seq_given;
355 /**< @brief Whether no-tx-gpdu-seq was given. */
jjako52c24142002-12-16 13:33:51 +0000356
Harald Weltebed35df2011-11-02 13:06:18 +0100357 };
Harald Welte1b3e5772010-05-04 11:13:56 +0200358
Harald Weltef6214982017-09-24 10:23:24 +0800359/** @brief The additional parameters to pass to parser functions */
360 struct cmdline_parser_params {
361 int override;
362 /**< @brief whether to override possibly already present options (default 0) */
363 int initialize;
364 /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */
365 int check_required;
366 /**< @brief whether to check that all required options were provided (default 1) */
367 int check_ambiguity;
368 /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */
369 int print_errors;
370 /**< @brief whether getopt_long should print an error message for a bad option (default 1) */
371 };
372
373/** @brief the purpose string of the program */
Harald Weltebed35df2011-11-02 13:06:18 +0100374 extern const char *gengetopt_args_info_purpose;
Harald Weltef6214982017-09-24 10:23:24 +0800375/** @brief the usage string of the program */
Harald Weltebed35df2011-11-02 13:06:18 +0100376 extern const char *gengetopt_args_info_usage;
Harald Weltef6214982017-09-24 10:23:24 +0800377/** @brief the description string of the program */
378 extern const char *gengetopt_args_info_description;
379/** @brief all the lines making the help output */
Harald Weltebed35df2011-11-02 13:06:18 +0100380 extern const char *gengetopt_args_info_help[];
jjako52c24142002-12-16 13:33:51 +0000381
Harald Weltef6214982017-09-24 10:23:24 +0800382/**
383 * The command line parser
384 * @param argc the number of command line options
385 * @param argv the command line options
386 * @param args_info the structure where option information will be stored
387 * @return 0 if everything went fine, NON 0 if an error took place
388 */
389 int cmdline_parser(int argc, char **argv,
Harald Weltebed35df2011-11-02 13:06:18 +0100390 struct gengetopt_args_info *args_info);
Harald Weltef6214982017-09-24 10:23:24 +0800391
392/**
393 * The command line parser (version with additional parameters - deprecated)
394 * @param argc the number of command line options
395 * @param argv the command line options
396 * @param args_info the structure where option information will be stored
397 * @param override whether to override possibly already present options
398 * @param initialize whether to initialize the option structure my_args_info
399 * @param check_required whether to check that all required options were provided
400 * @return 0 if everything went fine, NON 0 if an error took place
401 * @deprecated use cmdline_parser_ext() instead
402 */
403 int cmdline_parser2(int argc, char **argv,
Harald Weltebed35df2011-11-02 13:06:18 +0100404 struct gengetopt_args_info *args_info,
405 int override, int initialize, int check_required);
Harald Weltef6214982017-09-24 10:23:24 +0800406
407/**
408 * The command line parser (version with additional parameters)
409 * @param argc the number of command line options
410 * @param argv the command line options
411 * @param args_info the structure where option information will be stored
412 * @param params additional parameters for the parser
413 * @return 0 if everything went fine, NON 0 if an error took place
414 */
415 int cmdline_parser_ext(int argc, char **argv,
416 struct gengetopt_args_info *args_info,
417 struct cmdline_parser_params *params);
418
419/**
420 * Save the contents of the option struct into an already open FILE stream.
421 * @param outfile the stream where to dump options
422 * @param args_info the option struct to dump
423 * @return 0 if everything went fine, NON 0 if an error took place
424 */
425 int cmdline_parser_dump(FILE * outfile,
426 struct gengetopt_args_info *args_info);
427
428/**
429 * Save the contents of the option struct into a (text) file.
430 * This file can be read by the config file parser (if generated by gengetopt)
431 * @param filename the file where to save
432 * @param args_info the option struct to save
433 * @return 0 if everything went fine, NON 0 if an error took place
434 */
Harald Weltebed35df2011-11-02 13:06:18 +0100435 int cmdline_parser_file_save(const char *filename,
436 struct gengetopt_args_info *args_info);
jjako52c24142002-12-16 13:33:51 +0000437
Harald Weltef6214982017-09-24 10:23:24 +0800438/**
439 * Print the help
440 */
Harald Weltebed35df2011-11-02 13:06:18 +0100441 void cmdline_parser_print_help(void);
Harald Weltef6214982017-09-24 10:23:24 +0800442/**
443 * Print the version
444 */
Harald Weltebed35df2011-11-02 13:06:18 +0100445 void cmdline_parser_print_version(void);
Harald Welte1b3e5772010-05-04 11:13:56 +0200446
Harald Weltef6214982017-09-24 10:23:24 +0800447/**
448 * Initializes all the fields a cmdline_parser_params structure
449 * to their default values
450 * @param params the structure to initialize
451 */
452 void cmdline_parser_params_init(struct cmdline_parser_params *params);
453
454/**
455 * Allocates dynamically a cmdline_parser_params structure and initializes
456 * all its fields to their default values
457 * @return the created and initialized cmdline_parser_params structure
458 */
459 struct cmdline_parser_params *cmdline_parser_params_create(void);
460
461/**
462 * Initializes the passed gengetopt_args_info structure's fields
463 * (also set default values for options that have a default)
464 * @param args_info the structure to initialize
465 */
Harald Weltebed35df2011-11-02 13:06:18 +0100466 void cmdline_parser_init(struct gengetopt_args_info *args_info);
Harald Weltef6214982017-09-24 10:23:24 +0800467/**
468 * Deallocates the string fields of the gengetopt_args_info structure
469 * (but does not deallocate the structure itself)
470 * @param args_info the structure to deallocate
471 */
Harald Weltebed35df2011-11-02 13:06:18 +0100472 void cmdline_parser_free(struct gengetopt_args_info *args_info);
Harald Welte1b3e5772010-05-04 11:13:56 +0200473
Harald Weltef6214982017-09-24 10:23:24 +0800474/**
475 * The config file parser (deprecated version)
476 * @param filename the name of the config file
477 * @param args_info the structure where option information will be stored
478 * @param override whether to override possibly already present options
479 * @param initialize whether to initialize the option structure my_args_info
480 * @param check_required whether to check that all required options were provided
481 * @return 0 if everything went fine, NON 0 if an error took place
482 * @deprecated use cmdline_parser_config_file() instead
483 */
484 int cmdline_parser_configfile(const char *filename,
Harald Weltebed35df2011-11-02 13:06:18 +0100485 struct gengetopt_args_info *args_info,
486 int override, int initialize,
487 int check_required);
Harald Welte1b3e5772010-05-04 11:13:56 +0200488
Harald Weltef6214982017-09-24 10:23:24 +0800489/**
490 * The config file parser
491 * @param filename the name of the config file
492 * @param args_info the structure where option information will be stored
493 * @param params additional parameters for the parser
494 * @return 0 if everything went fine, NON 0 if an error took place
495 */
496 int cmdline_parser_config_file(const char *filename,
497 struct gengetopt_args_info *args_info,
498 struct cmdline_parser_params *params);
499
500/**
501 * Checks that all the required options were specified
502 * @param args_info the structure to check
503 * @param prog_name the name of the program that will be used to print
504 * possible errors
505 * @return
506 */
Harald Weltebed35df2011-11-02 13:06:18 +0100507 int cmdline_parser_required(struct gengetopt_args_info *args_info,
508 const char *prog_name);
jjako52c24142002-12-16 13:33:51 +0000509
510#ifdef __cplusplus
511}
Harald Weltebed35df2011-11-02 13:06:18 +0100512#endif /* __cplusplus */
513#endif /* CMDLINE_H */