Harald Welte | f621498 | 2017-09-24 10:23:24 +0800 | [diff] [blame] | 1 | /** @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 */ |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 7 | |
Harald Welte | 1b3e577 | 2010-05-04 11:13:56 +0200 | [diff] [blame] | 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 |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 15 | |
Harald Welte | f621498 | 2017-09-24 10:23:24 +0800 | [diff] [blame] | 16 | #include <stdio.h> /* for FILE */ |
| 17 | |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 18 | #ifdef __cplusplus |
| 19 | extern "C" { |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 20 | #endif /* __cplusplus */ |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 21 | |
Harald Welte | 1b3e577 | 2010-05-04 11:13:56 +0200 | [diff] [blame] | 22 | #ifndef CMDLINE_PARSER_PACKAGE |
Harald Welte | f621498 | 2017-09-24 10:23:24 +0800 | [diff] [blame] | 23 | /** @brief the program name (used for printing errors) */ |
Harald Welte | 7e1175f | 2017-09-24 10:53:53 +0800 | [diff] [blame] | 24 | #define CMDLINE_PARSER_PACKAGE "sgsnemu" |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 25 | #endif |
| 26 | |
Harald Welte | f621498 | 2017-09-24 10:23:24 +0800 | [diff] [blame] | 27 | #ifndef CMDLINE_PARSER_PACKAGE_NAME |
| 28 | /** @brief the complete program name (used for help and version) */ |
Harald Welte | 7e1175f | 2017-09-24 10:53:53 +0800 | [diff] [blame] | 29 | #define CMDLINE_PARSER_PACKAGE_NAME "sgsnemu" |
Harald Welte | f621498 | 2017-09-24 10:23:24 +0800 | [diff] [blame] | 30 | #endif |
| 31 | |
Harald Welte | 1b3e577 | 2010-05-04 11:13:56 +0200 | [diff] [blame] | 32 | #ifndef CMDLINE_PARSER_VERSION |
Harald Welte | f621498 | 2017-09-24 10:23:24 +0800 | [diff] [blame] | 33 | /** @brief the program version */ |
Harald Welte | 1b3e577 | 2010-05-04 11:13:56 +0200 | [diff] [blame] | 34 | #define CMDLINE_PARSER_VERSION VERSION |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 35 | #endif |
| 36 | |
Harald Welte | f621498 | 2017-09-24 10:23:24 +0800 | [diff] [blame] | 37 | /** @brief Where the command line options are stored */ |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 38 | struct gengetopt_args_info { |
Harald Welte | f621498 | 2017-09-24 10:23:24 +0800 | [diff] [blame] | 39 | 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; |
Pau Espin Pedrol | 5fdda13 | 2018-02-12 18:03:09 +0100 | [diff] [blame] | 72 | /**< @brief Local host. */ |
Harald Welte | f621498 | 2017-09-24 10:23:24 +0800 | [diff] [blame] | 73 | char *listen_orig; |
Pau Espin Pedrol | 5fdda13 | 2018-02-12 18:03:09 +0100 | [diff] [blame] | 74 | /**< @brief Local host original value given at command line. */ |
Harald Welte | f621498 | 2017-09-24 10:23:24 +0800 | [diff] [blame] | 75 | const char *listen_help; |
Pau Espin Pedrol | 5fdda13 | 2018-02-12 18:03:09 +0100 | [diff] [blame] | 76 | /**< @brief Local host help description. */ |
Harald Welte | f621498 | 2017-09-24 10:23:24 +0800 | [diff] [blame] | 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 Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 115 | char *rattype_orig; |
Harald Welte | f621498 | 2017-09-24 10:23:24 +0800 | [diff] [blame] | 116 | /**< @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 Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 121 | char *userloc_orig; |
Harald Welte | f621498 | 2017-09-24 10:23:24 +0800 | [diff] [blame] | 122 | /**< @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 Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 127 | char *rai_orig; |
Harald Welte | f621498 | 2017-09-24 10:23:24 +0800 | [diff] [blame] | 128 | /**< @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 Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 133 | char *mstz_orig; |
Harald Welte | f621498 | 2017-09-24 10:23:24 +0800 | [diff] [blame] | 134 | /**< @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 Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 139 | char *imeisv_orig; |
Harald Welte | f621498 | 2017-09-24 10:23:24 +0800 | [diff] [blame] | 140 | /**< @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. */ |
Harald Welte | 73abc38 | 2017-10-10 08:50:11 +0800 | [diff] [blame] | 239 | char *tun_device_arg; |
| 240 | /**< @brief Name of the local network interface. */ |
| 241 | char *tun_device_orig; |
| 242 | /**< @brief Name of the local network interface original value given at command line. */ |
| 243 | const char *tun_device_help; |
| 244 | /**< @brief Name of the local network interface help description. */ |
Andreas Schultz | b629240 | 2018-10-05 13:58:45 +0100 | [diff] [blame] | 245 | char *netns_arg; |
| 246 | /**< @brief Network namespace to use. */ |
| 247 | char *netns_orig; |
| 248 | /**< @brief Network namespace to use original value given at command line. */ |
| 249 | const char *netns_help; |
| 250 | /**< @brief Network namespace to use help description. */ |
Harald Welte | f621498 | 2017-09-24 10:23:24 +0800 | [diff] [blame] | 251 | char *pinghost_arg; |
| 252 | /**< @brief Ping remote host. */ |
| 253 | char *pinghost_orig; |
| 254 | /**< @brief Ping remote host original value given at command line. */ |
| 255 | const char *pinghost_help; |
| 256 | /**< @brief Ping remote host help description. */ |
| 257 | int pingrate_arg; |
| 258 | /**< @brief Number of ping req per second (default='1'). */ |
| 259 | char *pingrate_orig; |
| 260 | /**< @brief Number of ping req per second original value given at command line. */ |
| 261 | const char *pingrate_help; |
| 262 | /**< @brief Number of ping req per second help description. */ |
| 263 | int pingsize_arg; |
| 264 | /**< @brief Number of ping data bytes (default='56'). */ |
| 265 | char *pingsize_orig; |
| 266 | /**< @brief Number of ping data bytes original value given at command line. */ |
| 267 | const char *pingsize_help; |
| 268 | /**< @brief Number of ping data bytes help description. */ |
| 269 | int pingcount_arg; |
| 270 | /**< @brief Number of ping req to send (default='0'). */ |
| 271 | char *pingcount_orig; |
| 272 | /**< @brief Number of ping req to send original value given at command line. */ |
| 273 | const char *pingcount_help; |
| 274 | /**< @brief Number of ping req to send help description. */ |
| 275 | int pingquiet_flag; |
| 276 | /**< @brief Do not print ping packet info (default=off). */ |
| 277 | const char *pingquiet_help; |
| 278 | /**< @brief Do not print ping packet info help description. */ |
Harald Welte | fbb9c7f | 2017-09-24 11:50:20 +0800 | [diff] [blame] | 279 | int no_tx_gpdu_seq_flag; |
| 280 | /**< @brief Don't transmit G-PDU sequence nums (default=off). */ |
| 281 | const char *no_tx_gpdu_seq_help; |
| 282 | /**< @brief Don't transmit G-PDU sequence nums help description. */ |
Harald Welte | 840a8e9 | 2017-09-24 18:12:40 +0800 | [diff] [blame] | 283 | char *pdp_type_arg; |
| 284 | /**< @brief PDP Type (default='v4'). */ |
| 285 | char *pdp_type_orig; |
| 286 | /**< @brief PDP Type original value given at command line. */ |
| 287 | const char *pdp_type_help; |
| 288 | /**< @brief PDP Type help description. */ |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 289 | |
Harald Welte | f621498 | 2017-09-24 10:23:24 +0800 | [diff] [blame] | 290 | unsigned int help_given; |
| 291 | /**< @brief Whether help was given. */ |
| 292 | unsigned int version_given; |
| 293 | /**< @brief Whether version was given. */ |
| 294 | unsigned int debug_given; |
| 295 | /**< @brief Whether debug was given. */ |
| 296 | unsigned int conf_given; |
| 297 | /**< @brief Whether conf was given. */ |
| 298 | unsigned int pidfile_given; |
| 299 | /**< @brief Whether pidfile was given. */ |
| 300 | unsigned int statedir_given; |
| 301 | /**< @brief Whether statedir was given. */ |
| 302 | unsigned int dns_given; |
| 303 | /**< @brief Whether dns was given. */ |
| 304 | unsigned int listen_given; |
| 305 | /**< @brief Whether listen was given. */ |
| 306 | unsigned int remote_given; |
| 307 | /**< @brief Whether remote was given. */ |
| 308 | unsigned int contexts_given; |
| 309 | /**< @brief Whether contexts was given. */ |
| 310 | unsigned int timelimit_given; |
| 311 | /**< @brief Whether timelimit was given. */ |
| 312 | unsigned int gtpversion_given; |
| 313 | /**< @brief Whether gtpversion was given. */ |
| 314 | unsigned int apn_given; |
| 315 | /**< @brief Whether apn was given. */ |
| 316 | unsigned int selmode_given; |
| 317 | /**< @brief Whether selmode was given. */ |
| 318 | unsigned int rattype_given; |
| 319 | /**< @brief Whether rattype was given. */ |
| 320 | unsigned int userloc_given; |
| 321 | /**< @brief Whether userloc was given. */ |
| 322 | unsigned int rai_given; |
| 323 | /**< @brief Whether rai was given. */ |
| 324 | unsigned int mstz_given; |
| 325 | /**< @brief Whether mstz was given. */ |
| 326 | unsigned int imeisv_given; |
| 327 | /**< @brief Whether imeisv was given. */ |
| 328 | unsigned int norecovery_given; |
| 329 | /**< @brief Whether norecovery was given. */ |
| 330 | unsigned int imsi_given; |
| 331 | /**< @brief Whether imsi was given. */ |
| 332 | unsigned int nsapi_given; |
| 333 | /**< @brief Whether nsapi was given. */ |
| 334 | unsigned int msisdn_given; |
| 335 | /**< @brief Whether msisdn was given. */ |
| 336 | unsigned int qos_given; |
| 337 | /**< @brief Whether qos was given. */ |
| 338 | unsigned int qose1_given; |
| 339 | /**< @brief Whether qose1 was given. */ |
| 340 | unsigned int qose2_given; |
| 341 | /**< @brief Whether qose2 was given. */ |
| 342 | unsigned int qose3_given; |
| 343 | /**< @brief Whether qose3 was given. */ |
| 344 | unsigned int qose4_given; |
| 345 | /**< @brief Whether qose4 was given. */ |
| 346 | unsigned int charging_given; |
| 347 | /**< @brief Whether charging was given. */ |
| 348 | unsigned int uid_given; |
| 349 | /**< @brief Whether uid was given. */ |
| 350 | unsigned int pwd_given; |
| 351 | /**< @brief Whether pwd was given. */ |
| 352 | unsigned int createif_given; |
| 353 | /**< @brief Whether createif was given. */ |
| 354 | unsigned int net_given; |
| 355 | /**< @brief Whether net was given. */ |
| 356 | unsigned int defaultroute_given; |
| 357 | /**< @brief Whether defaultroute was given. */ |
| 358 | unsigned int ipup_given; |
| 359 | /**< @brief Whether ipup was given. */ |
| 360 | unsigned int ipdown_given; |
| 361 | /**< @brief Whether ipdown was given. */ |
Harald Welte | 73abc38 | 2017-10-10 08:50:11 +0800 | [diff] [blame] | 362 | unsigned int tun_device_given; |
| 363 | /**< @brief Whether tun-device was given. */ |
Andreas Schultz | b629240 | 2018-10-05 13:58:45 +0100 | [diff] [blame] | 364 | unsigned int netns_given; |
| 365 | /**< @brief Whether netns was given. */ |
Harald Welte | f621498 | 2017-09-24 10:23:24 +0800 | [diff] [blame] | 366 | unsigned int pinghost_given; |
| 367 | /**< @brief Whether pinghost was given. */ |
| 368 | unsigned int pingrate_given; |
| 369 | /**< @brief Whether pingrate was given. */ |
| 370 | unsigned int pingsize_given; |
| 371 | /**< @brief Whether pingsize was given. */ |
| 372 | unsigned int pingcount_given; |
| 373 | /**< @brief Whether pingcount was given. */ |
| 374 | unsigned int pingquiet_given; |
| 375 | /**< @brief Whether pingquiet was given. */ |
Harald Welte | fbb9c7f | 2017-09-24 11:50:20 +0800 | [diff] [blame] | 376 | unsigned int no_tx_gpdu_seq_given; |
| 377 | /**< @brief Whether no-tx-gpdu-seq was given. */ |
Harald Welte | 840a8e9 | 2017-09-24 18:12:40 +0800 | [diff] [blame] | 378 | unsigned int pdp_type_given; |
| 379 | /**< @brief Whether pdp-type was given. */ |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 380 | |
Viktor Tsymbalyuk | ab4db10 | 2018-01-30 14:40:12 +0200 | [diff] [blame] | 381 | int createif_mode_counter; |
| 382 | /**< @brief Counter for mode createif */ |
| 383 | int pinghost_mode_counter; |
| 384 | /**< @brief Counter for mode pinghost */ |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 385 | }; |
Harald Welte | 1b3e577 | 2010-05-04 11:13:56 +0200 | [diff] [blame] | 386 | |
Harald Welte | f621498 | 2017-09-24 10:23:24 +0800 | [diff] [blame] | 387 | /** @brief The additional parameters to pass to parser functions */ |
| 388 | struct cmdline_parser_params { |
| 389 | int override; |
| 390 | /**< @brief whether to override possibly already present options (default 0) */ |
| 391 | int initialize; |
| 392 | /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */ |
| 393 | int check_required; |
| 394 | /**< @brief whether to check that all required options were provided (default 1) */ |
| 395 | int check_ambiguity; |
| 396 | /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */ |
| 397 | int print_errors; |
| 398 | /**< @brief whether getopt_long should print an error message for a bad option (default 1) */ |
| 399 | }; |
| 400 | |
| 401 | /** @brief the purpose string of the program */ |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 402 | extern const char *gengetopt_args_info_purpose; |
Harald Welte | f621498 | 2017-09-24 10:23:24 +0800 | [diff] [blame] | 403 | /** @brief the usage string of the program */ |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 404 | extern const char *gengetopt_args_info_usage; |
Harald Welte | f621498 | 2017-09-24 10:23:24 +0800 | [diff] [blame] | 405 | /** @brief the description string of the program */ |
| 406 | extern const char *gengetopt_args_info_description; |
| 407 | /** @brief all the lines making the help output */ |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 408 | extern const char *gengetopt_args_info_help[]; |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 409 | |
Harald Welte | f621498 | 2017-09-24 10:23:24 +0800 | [diff] [blame] | 410 | /** |
| 411 | * The command line parser |
| 412 | * @param argc the number of command line options |
| 413 | * @param argv the command line options |
| 414 | * @param args_info the structure where option information will be stored |
| 415 | * @return 0 if everything went fine, NON 0 if an error took place |
| 416 | */ |
| 417 | int cmdline_parser(int argc, char **argv, |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 418 | struct gengetopt_args_info *args_info); |
Harald Welte | f621498 | 2017-09-24 10:23:24 +0800 | [diff] [blame] | 419 | |
| 420 | /** |
| 421 | * The command line parser (version with additional parameters - deprecated) |
| 422 | * @param argc the number of command line options |
| 423 | * @param argv the command line options |
| 424 | * @param args_info the structure where option information will be stored |
| 425 | * @param override whether to override possibly already present options |
| 426 | * @param initialize whether to initialize the option structure my_args_info |
| 427 | * @param check_required whether to check that all required options were provided |
| 428 | * @return 0 if everything went fine, NON 0 if an error took place |
| 429 | * @deprecated use cmdline_parser_ext() instead |
| 430 | */ |
| 431 | int cmdline_parser2(int argc, char **argv, |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 432 | struct gengetopt_args_info *args_info, |
| 433 | int override, int initialize, int check_required); |
Harald Welte | f621498 | 2017-09-24 10:23:24 +0800 | [diff] [blame] | 434 | |
| 435 | /** |
| 436 | * The command line parser (version with additional parameters) |
| 437 | * @param argc the number of command line options |
| 438 | * @param argv the command line options |
| 439 | * @param args_info the structure where option information will be stored |
| 440 | * @param params additional parameters for the parser |
| 441 | * @return 0 if everything went fine, NON 0 if an error took place |
| 442 | */ |
| 443 | int cmdline_parser_ext(int argc, char **argv, |
| 444 | struct gengetopt_args_info *args_info, |
| 445 | struct cmdline_parser_params *params); |
| 446 | |
| 447 | /** |
| 448 | * Save the contents of the option struct into an already open FILE stream. |
| 449 | * @param outfile the stream where to dump options |
| 450 | * @param args_info the option struct to dump |
| 451 | * @return 0 if everything went fine, NON 0 if an error took place |
| 452 | */ |
| 453 | int cmdline_parser_dump(FILE * outfile, |
| 454 | struct gengetopt_args_info *args_info); |
| 455 | |
| 456 | /** |
| 457 | * Save the contents of the option struct into a (text) file. |
| 458 | * This file can be read by the config file parser (if generated by gengetopt) |
| 459 | * @param filename the file where to save |
| 460 | * @param args_info the option struct to save |
| 461 | * @return 0 if everything went fine, NON 0 if an error took place |
| 462 | */ |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 463 | int cmdline_parser_file_save(const char *filename, |
| 464 | struct gengetopt_args_info *args_info); |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 465 | |
Harald Welte | f621498 | 2017-09-24 10:23:24 +0800 | [diff] [blame] | 466 | /** |
| 467 | * Print the help |
| 468 | */ |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 469 | void cmdline_parser_print_help(void); |
Harald Welte | f621498 | 2017-09-24 10:23:24 +0800 | [diff] [blame] | 470 | /** |
| 471 | * Print the version |
| 472 | */ |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 473 | void cmdline_parser_print_version(void); |
Harald Welte | 1b3e577 | 2010-05-04 11:13:56 +0200 | [diff] [blame] | 474 | |
Harald Welte | f621498 | 2017-09-24 10:23:24 +0800 | [diff] [blame] | 475 | /** |
| 476 | * Initializes all the fields a cmdline_parser_params structure |
| 477 | * to their default values |
| 478 | * @param params the structure to initialize |
| 479 | */ |
| 480 | void cmdline_parser_params_init(struct cmdline_parser_params *params); |
| 481 | |
| 482 | /** |
| 483 | * Allocates dynamically a cmdline_parser_params structure and initializes |
| 484 | * all its fields to their default values |
| 485 | * @return the created and initialized cmdline_parser_params structure |
| 486 | */ |
| 487 | struct cmdline_parser_params *cmdline_parser_params_create(void); |
| 488 | |
| 489 | /** |
| 490 | * Initializes the passed gengetopt_args_info structure's fields |
| 491 | * (also set default values for options that have a default) |
| 492 | * @param args_info the structure to initialize |
| 493 | */ |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 494 | void cmdline_parser_init(struct gengetopt_args_info *args_info); |
Harald Welte | f621498 | 2017-09-24 10:23:24 +0800 | [diff] [blame] | 495 | /** |
| 496 | * Deallocates the string fields of the gengetopt_args_info structure |
| 497 | * (but does not deallocate the structure itself) |
| 498 | * @param args_info the structure to deallocate |
| 499 | */ |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 500 | void cmdline_parser_free(struct gengetopt_args_info *args_info); |
Harald Welte | 1b3e577 | 2010-05-04 11:13:56 +0200 | [diff] [blame] | 501 | |
Harald Welte | f621498 | 2017-09-24 10:23:24 +0800 | [diff] [blame] | 502 | /** |
| 503 | * The config file parser (deprecated version) |
| 504 | * @param filename the name of the config file |
| 505 | * @param args_info the structure where option information will be stored |
| 506 | * @param override whether to override possibly already present options |
| 507 | * @param initialize whether to initialize the option structure my_args_info |
| 508 | * @param check_required whether to check that all required options were provided |
| 509 | * @return 0 if everything went fine, NON 0 if an error took place |
| 510 | * @deprecated use cmdline_parser_config_file() instead |
| 511 | */ |
| 512 | int cmdline_parser_configfile(const char *filename, |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 513 | struct gengetopt_args_info *args_info, |
| 514 | int override, int initialize, |
| 515 | int check_required); |
Harald Welte | 1b3e577 | 2010-05-04 11:13:56 +0200 | [diff] [blame] | 516 | |
Harald Welte | f621498 | 2017-09-24 10:23:24 +0800 | [diff] [blame] | 517 | /** |
| 518 | * The config file parser |
| 519 | * @param filename the name of the config file |
| 520 | * @param args_info the structure where option information will be stored |
| 521 | * @param params additional parameters for the parser |
| 522 | * @return 0 if everything went fine, NON 0 if an error took place |
| 523 | */ |
| 524 | int cmdline_parser_config_file(const char *filename, |
| 525 | struct gengetopt_args_info *args_info, |
| 526 | struct cmdline_parser_params *params); |
| 527 | |
| 528 | /** |
| 529 | * Checks that all the required options were specified |
| 530 | * @param args_info the structure to check |
| 531 | * @param prog_name the name of the program that will be used to print |
| 532 | * possible errors |
| 533 | * @return |
| 534 | */ |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 535 | int cmdline_parser_required(struct gengetopt_args_info *args_info, |
| 536 | const char *prog_name); |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 537 | |
| 538 | #ifdef __cplusplus |
| 539 | } |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 540 | #endif /* __cplusplus */ |
| 541 | #endif /* CMDLINE_H */ |