zopt.h 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  1. /** @file zopt.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 */
  7. #ifndef ZOPT_H
  8. #define ZOPT_H
  9. /* If we use autoconf. */
  10. #ifdef HAVE_CONFIG_H
  11. #include "config.h"
  12. #endif
  13. #include <stdio.h> /* for FILE */
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif /* __cplusplus */
  17. #ifndef CMDLINE_PARSER_PACKAGE
  18. /** @brief the program name (used for printing errors) */
  19. #define CMDLINE_PARSER_PACKAGE "zmap"
  20. #endif
  21. #ifndef CMDLINE_PARSER_PACKAGE_NAME
  22. /** @brief the complete program name (used for help and version) */
  23. #define CMDLINE_PARSER_PACKAGE_NAME "zmap"
  24. #endif
  25. #ifndef CMDLINE_PARSER_VERSION
  26. /** @brief the program version */
  27. #define CMDLINE_PARSER_VERSION "2.1.0-RC1"
  28. #endif
  29. /** @brief Where the command line options are stored */
  30. struct gengetopt_args_info
  31. {
  32. int target_port_arg; /**< @brief port number to scan (for TCP and UDP scans). */
  33. char * target_port_orig; /**< @brief port number to scan (for TCP and UDP scans) original value given at command line. */
  34. const char *target_port_help; /**< @brief port number to scan (for TCP and UDP scans) help description. */
  35. char * output_file_arg; /**< @brief Output file. */
  36. char * output_file_orig; /**< @brief Output file original value given at command line. */
  37. const char *output_file_help; /**< @brief Output file help description. */
  38. char * blacklist_file_arg; /**< @brief File of subnets to exclude, in CIDR notation, e.g. 192.168.0.0/16. */
  39. char * blacklist_file_orig; /**< @brief File of subnets to exclude, in CIDR notation, e.g. 192.168.0.0/16 original value given at command line. */
  40. const char *blacklist_file_help; /**< @brief File of subnets to exclude, in CIDR notation, e.g. 192.168.0.0/16 help description. */
  41. char * whitelist_file_arg; /**< @brief File of subnets to constrain scan to, in CIDR notation, e.g. 192.168.0.0/16. */
  42. char * whitelist_file_orig; /**< @brief File of subnets to constrain scan to, in CIDR notation, e.g. 192.168.0.0/16 original value given at command line. */
  43. const char *whitelist_file_help; /**< @brief File of subnets to constrain scan to, in CIDR notation, e.g. 192.168.0.0/16 help description. */
  44. int rate_arg; /**< @brief Set send rate in packets/sec. */
  45. char * rate_orig; /**< @brief Set send rate in packets/sec original value given at command line. */
  46. const char *rate_help; /**< @brief Set send rate in packets/sec help description. */
  47. char * bandwidth_arg; /**< @brief Set send rate in bits/second (supports suffixes G, M and K). */
  48. char * bandwidth_orig; /**< @brief Set send rate in bits/second (supports suffixes G, M and K) original value given at command line. */
  49. const char *bandwidth_help; /**< @brief Set send rate in bits/second (supports suffixes G, M and K) help description. */
  50. char * max_targets_arg; /**< @brief Cap number of targets to probe (as a number or a percentage of the address space). */
  51. char * max_targets_orig; /**< @brief Cap number of targets to probe (as a number or a percentage of the address space) original value given at command line. */
  52. const char *max_targets_help; /**< @brief Cap number of targets to probe (as a number or a percentage of the address space) help description. */
  53. int max_runtime_arg; /**< @brief Cap length of time for sending packets. */
  54. char * max_runtime_orig; /**< @brief Cap length of time for sending packets original value given at command line. */
  55. const char *max_runtime_help; /**< @brief Cap length of time for sending packets help description. */
  56. int max_results_arg; /**< @brief Cap number of results to return. */
  57. char * max_results_orig; /**< @brief Cap number of results to return original value given at command line. */
  58. const char *max_results_help; /**< @brief Cap number of results to return help description. */
  59. int probes_arg; /**< @brief Number of probes to send to each IP (default='1'). */
  60. char * probes_orig; /**< @brief Number of probes to send to each IP original value given at command line. */
  61. const char *probes_help; /**< @brief Number of probes to send to each IP help description. */
  62. int cooldown_time_arg; /**< @brief How long to continue receiving after sending last probe (default='8'). */
  63. char * cooldown_time_orig; /**< @brief How long to continue receiving after sending last probe original value given at command line. */
  64. const char *cooldown_time_help; /**< @brief How long to continue receiving after sending last probe help description. */
  65. #if defined(HAVE_LONG_LONG) || defined(HAVE_LONG_LONG_INT)
  66. long long int seed_arg; /**< @brief Seed used to select address permutation. */
  67. #else
  68. long seed_arg; /**< @brief Seed used to select address permutation. */
  69. #endif
  70. char * seed_orig; /**< @brief Seed used to select address permutation original value given at command line. */
  71. const char *seed_help; /**< @brief Seed used to select address permutation help description. */
  72. int retries_arg; /**< @brief Max number of times to try to send packet if send fails (default='10'). */
  73. char * retries_orig; /**< @brief Max number of times to try to send packet if send fails original value given at command line. */
  74. const char *retries_help; /**< @brief Max number of times to try to send packet if send fails help description. */
  75. const char *dryrun_help; /**< @brief Don't actually send packets help description. */
  76. int shards_arg; /**< @brief Set the total number of shards (default='1'). */
  77. char * shards_orig; /**< @brief Set the total number of shards original value given at command line. */
  78. const char *shards_help; /**< @brief Set the total number of shards help description. */
  79. int shard_arg; /**< @brief Set which shard this scan is (0 indexed) (default='0'). */
  80. char * shard_orig; /**< @brief Set which shard this scan is (0 indexed) original value given at command line. */
  81. const char *shard_help; /**< @brief Set which shard this scan is (0 indexed) help description. */
  82. char * source_port_arg; /**< @brief Source port(s) for scan packets. */
  83. char * source_port_orig; /**< @brief Source port(s) for scan packets original value given at command line. */
  84. const char *source_port_help; /**< @brief Source port(s) for scan packets help description. */
  85. char * source_ip_arg; /**< @brief Source address(es) for scan packets. */
  86. char * source_ip_orig; /**< @brief Source address(es) for scan packets original value given at command line. */
  87. const char *source_ip_help; /**< @brief Source address(es) for scan packets help description. */
  88. char * gateway_mac_arg; /**< @brief Specify gateway MAC address. */
  89. char * gateway_mac_orig; /**< @brief Specify gateway MAC address original value given at command line. */
  90. const char *gateway_mac_help; /**< @brief Specify gateway MAC address help description. */
  91. char * source_mac_arg; /**< @brief Source MAC address. */
  92. char * source_mac_orig; /**< @brief Source MAC address original value given at command line. */
  93. const char *source_mac_help; /**< @brief Source MAC address help description. */
  94. char * interface_arg; /**< @brief Specify network interface to use. */
  95. char * interface_orig; /**< @brief Specify network interface to use original value given at command line. */
  96. const char *interface_help; /**< @brief Specify network interface to use help description. */
  97. const char *vpn_help; /**< @brief Sends IP packets instead of Ethernet (for VPNs) help description. */
  98. char * probe_module_arg; /**< @brief Select probe module (default='tcp_synscan'). */
  99. char * probe_module_orig; /**< @brief Select probe module original value given at command line. */
  100. const char *probe_module_help; /**< @brief Select probe module help description. */
  101. char * probe_args_arg; /**< @brief Arguments to pass to probe module. */
  102. char * probe_args_orig; /**< @brief Arguments to pass to probe module original value given at command line. */
  103. const char *probe_args_help; /**< @brief Arguments to pass to probe module help description. */
  104. const char *list_probe_modules_help; /**< @brief List available probe modules help description. */
  105. char * output_fields_arg; /**< @brief Fields that should be output in result set. */
  106. char * output_fields_orig; /**< @brief Fields that should be output in result set original value given at command line. */
  107. const char *output_fields_help; /**< @brief Fields that should be output in result set help description. */
  108. char * output_module_arg; /**< @brief Select output module (default='default'). */
  109. char * output_module_orig; /**< @brief Select output module original value given at command line. */
  110. const char *output_module_help; /**< @brief Select output module help description. */
  111. char * output_args_arg; /**< @brief Arguments to pass to output module. */
  112. char * output_args_orig; /**< @brief Arguments to pass to output module original value given at command line. */
  113. const char *output_args_help; /**< @brief Arguments to pass to output module help description. */
  114. char * output_filter_arg; /**< @brief Specify a filter over the response fields to limit what responses get sent to the output module. */
  115. char * output_filter_orig; /**< @brief Specify a filter over the response fields to limit what responses get sent to the output module original value given at command line. */
  116. const char *output_filter_help; /**< @brief Specify a filter over the response fields to limit what responses get sent to the output module help description. */
  117. const char *list_output_modules_help; /**< @brief List available output modules help description. */
  118. const char *list_output_fields_help; /**< @brief List all fields that can be output by selected probe module help description. */
  119. int verbosity_arg; /**< @brief Level of log detail (0-5) (default='3'). */
  120. char * verbosity_orig; /**< @brief Level of log detail (0-5) original value given at command line. */
  121. const char *verbosity_help; /**< @brief Level of log detail (0-5) help description. */
  122. char * log_file_arg; /**< @brief Write log entries to file. */
  123. char * log_file_orig; /**< @brief Write log entries to file original value given at command line. */
  124. const char *log_file_help; /**< @brief Write log entries to file help description. */
  125. char * log_directory_arg; /**< @brief Write log entries to a timestamped file in this directory. */
  126. char * log_directory_orig; /**< @brief Write log entries to a timestamped file in this directory original value given at command line. */
  127. const char *log_directory_help; /**< @brief Write log entries to a timestamped file in this directory help description. */
  128. char * metadata_file_arg; /**< @brief Output file for scan metadata (JSON). */
  129. char * metadata_file_orig; /**< @brief Output file for scan metadata (JSON) original value given at command line. */
  130. const char *metadata_file_help; /**< @brief Output file for scan metadata (JSON) help description. */
  131. char * status_updates_file_arg; /**< @brief Write scan progress updates to CSV file. */
  132. char * status_updates_file_orig; /**< @brief Write scan progress updates to CSV file original value given at command line. */
  133. const char *status_updates_file_help; /**< @brief Write scan progress updates to CSV file help description. */
  134. const char *quiet_help; /**< @brief Do not print status updates help description. */
  135. const char *disable_syslog_help; /**< @brief Disables logging messages to syslog help description. */
  136. char * notes_arg; /**< @brief Inject user-specified notes into scan metadata. */
  137. char * notes_orig; /**< @brief Inject user-specified notes into scan metadata original value given at command line. */
  138. const char *notes_help; /**< @brief Inject user-specified notes into scan metadata help description. */
  139. char * user_metadata_arg; /**< @brief Inject user-specified JSON metadata into scan metadata. */
  140. char * user_metadata_orig; /**< @brief Inject user-specified JSON metadata into scan metadata original value given at command line. */
  141. const char *user_metadata_help; /**< @brief Inject user-specified JSON metadata into scan metadata help description. */
  142. int marker_encoding_arg; /**< @brief Marker to be used to encode destination address/checksum (TCP probe module) (default='0'). */
  143. char * marker_encoding_orig; /**< @brief Marker to be used to encode destination address/checksum (TCP probe module) original value given at command line. */
  144. const char *marker_encoding_help; /**< @brief Marker to be used to encode destination address/checksum (TCP probe module) help description. */
  145. int use_markervalue_arg; /**< @brief Use markervalue instead of target IP address for encoding (default='0'). */
  146. char * use_markervalue_orig; /**< @brief Use markervalue instead of target IP address for encoding original value given at command line. */
  147. const char *use_markervalue_help; /**< @brief Use markervalue instead of target IP address for encoding help description. */
  148. char * markervalue_arg; /**< @brief Value to be used instead of target IP address for encoding (default='0'). */
  149. char * markervalue_orig; /**< @brief Value to be used instead of target IP address for encoding original value given at command line. */
  150. const char *markervalue_help; /**< @brief Value to be used instead of target IP address for encoding help description. */
  151. int markerbits_value_arg; /**< @brief Amount of Bits of the IP address (32 Bit total) to be encoded (TCP probe module) (default='0'). */
  152. char * markerbits_value_orig; /**< @brief Amount of Bits of the IP address (32 Bit total) to be encoded (TCP probe module) original value given at command line. */
  153. const char *markerbits_value_help; /**< @brief Amount of Bits of the IP address (32 Bit total) to be encoded (TCP probe module) help description. */
  154. int markerbits_checksum_arg; /**< @brief Amount of Bits of the checksum (32 Bit total) to be encoded (TCP probe module) (default='0'). */
  155. char * markerbits_checksum_orig; /**< @brief Amount of Bits of the checksum (32 Bit total) to be encoded (TCP probe module) original value given at command line. */
  156. const char *markerbits_checksum_help; /**< @brief Amount of Bits of the checksum (32 Bit total) to be encoded (TCP probe module) help description. */
  157. int markerbits_dst_small_arg; /**< @brief Anti-Mitigation (TraCINg): just use destination port for encoding. (default='0'). */
  158. char * markerbits_dst_small_orig; /**< @brief Anti-Mitigation (TraCINg): just use destination port for encoding. original value given at command line. */
  159. const char *markerbits_dst_small_help; /**< @brief Anti-Mitigation (TraCINg): just use destination port for encoding. help description. */
  160. int disable_monitor_arg; /**< @brief Disable monitor output. This is intended for small scan groups (<100000) (default='0'). */
  161. char * disable_monitor_orig; /**< @brief Disable monitor output. This is intended for small scan groups (<100000) original value given at command line. */
  162. const char *disable_monitor_help; /**< @brief Disable monitor output. This is intended for small scan groups (<100000) help description. */
  163. char * config_arg; /**< @brief Read a configuration file, which can specify any of these options (default='/etc/zmap/zmap.conf'). */
  164. char * config_orig; /**< @brief Read a configuration file, which can specify any of these options original value given at command line. */
  165. const char *config_help; /**< @brief Read a configuration file, which can specify any of these options help description. */
  166. int max_sendto_failures_arg; /**< @brief Maximum NIC sendto failures before scan is aborted (default='-1'). */
  167. char * max_sendto_failures_orig; /**< @brief Maximum NIC sendto failures before scan is aborted original value given at command line. */
  168. const char *max_sendto_failures_help; /**< @brief Maximum NIC sendto failures before scan is aborted help description. */
  169. float min_hitrate_arg; /**< @brief Minimum hitrate that scan can hit before scan is aborted (default='0.0'). */
  170. char * min_hitrate_orig; /**< @brief Minimum hitrate that scan can hit before scan is aborted original value given at command line. */
  171. const char *min_hitrate_help; /**< @brief Minimum hitrate that scan can hit before scan is aborted help description. */
  172. int sender_threads_arg; /**< @brief Threads used to send packets (default='1'). */
  173. char * sender_threads_orig; /**< @brief Threads used to send packets original value given at command line. */
  174. const char *sender_threads_help; /**< @brief Threads used to send packets help description. */
  175. char * cores_arg; /**< @brief Comma-separated list of cores to pin to. */
  176. char * cores_orig; /**< @brief Comma-separated list of cores to pin to original value given at command line. */
  177. const char *cores_help; /**< @brief Comma-separated list of cores to pin to help description. */
  178. const char *ignore_invalid_hosts_help; /**< @brief Ignore invalid hosts in whitelist/blacklist file help description. */
  179. const char *help_help; /**< @brief Print help and exit help description. */
  180. const char *version_help; /**< @brief Print version and exit help description. */
  181. unsigned int target_port_given ; /**< @brief Whether target-port was given. */
  182. unsigned int output_file_given ; /**< @brief Whether output-file was given. */
  183. unsigned int blacklist_file_given ; /**< @brief Whether blacklist-file was given. */
  184. unsigned int whitelist_file_given ; /**< @brief Whether whitelist-file was given. */
  185. unsigned int rate_given ; /**< @brief Whether rate was given. */
  186. unsigned int bandwidth_given ; /**< @brief Whether bandwidth was given. */
  187. unsigned int max_targets_given ; /**< @brief Whether max-targets was given. */
  188. unsigned int max_runtime_given ; /**< @brief Whether max-runtime was given. */
  189. unsigned int max_results_given ; /**< @brief Whether max-results was given. */
  190. unsigned int probes_given ; /**< @brief Whether probes was given. */
  191. unsigned int cooldown_time_given ; /**< @brief Whether cooldown-time was given. */
  192. unsigned int seed_given ; /**< @brief Whether seed was given. */
  193. unsigned int retries_given ; /**< @brief Whether retries was given. */
  194. unsigned int dryrun_given ; /**< @brief Whether dryrun was given. */
  195. unsigned int shards_given ; /**< @brief Whether shards was given. */
  196. unsigned int shard_given ; /**< @brief Whether shard was given. */
  197. unsigned int source_port_given ; /**< @brief Whether source-port was given. */
  198. unsigned int source_ip_given ; /**< @brief Whether source-ip was given. */
  199. unsigned int gateway_mac_given ; /**< @brief Whether gateway-mac was given. */
  200. unsigned int source_mac_given ; /**< @brief Whether source-mac was given. */
  201. unsigned int interface_given ; /**< @brief Whether interface was given. */
  202. unsigned int vpn_given ; /**< @brief Whether vpn was given. */
  203. unsigned int probe_module_given ; /**< @brief Whether probe-module was given. */
  204. unsigned int probe_args_given ; /**< @brief Whether probe-args was given. */
  205. unsigned int list_probe_modules_given ; /**< @brief Whether list-probe-modules was given. */
  206. unsigned int output_fields_given ; /**< @brief Whether output-fields was given. */
  207. unsigned int output_module_given ; /**< @brief Whether output-module was given. */
  208. unsigned int output_args_given ; /**< @brief Whether output-args was given. */
  209. unsigned int output_filter_given ; /**< @brief Whether output-filter was given. */
  210. unsigned int list_output_modules_given ; /**< @brief Whether list-output-modules was given. */
  211. unsigned int list_output_fields_given ; /**< @brief Whether list-output-fields was given. */
  212. unsigned int verbosity_given ; /**< @brief Whether verbosity was given. */
  213. unsigned int log_file_given ; /**< @brief Whether log-file was given. */
  214. unsigned int log_directory_given ; /**< @brief Whether log-directory was given. */
  215. unsigned int metadata_file_given ; /**< @brief Whether metadata-file was given. */
  216. unsigned int status_updates_file_given ; /**< @brief Whether status-updates-file was given. */
  217. unsigned int quiet_given ; /**< @brief Whether quiet was given. */
  218. unsigned int disable_syslog_given ; /**< @brief Whether disable-syslog was given. */
  219. unsigned int notes_given ; /**< @brief Whether notes was given. */
  220. unsigned int user_metadata_given ; /**< @brief Whether user-metadata was given. */
  221. unsigned int marker_encoding_given ; /**< @brief Whether marker_encoding was given. */
  222. unsigned int use_markervalue_given ; /**< @brief Whether use_markervalue was given. */
  223. unsigned int markervalue_given ; /**< @brief Whether markervalue was given. */
  224. unsigned int markerbits_value_given ; /**< @brief Whether markerbits_value was given. */
  225. unsigned int markerbits_checksum_given ; /**< @brief Whether markerbits_checksum was given. */
  226. unsigned int markerbits_dst_small_given ; /**< @brief Whether markerbits_dst_small was given. */
  227. unsigned int disable_monitor_given ; /**< @brief Whether disable_monitor was given. */
  228. unsigned int config_given ; /**< @brief Whether config was given. */
  229. unsigned int max_sendto_failures_given ; /**< @brief Whether max-sendto-failures was given. */
  230. unsigned int min_hitrate_given ; /**< @brief Whether min-hitrate was given. */
  231. unsigned int sender_threads_given ; /**< @brief Whether sender-threads was given. */
  232. unsigned int cores_given ; /**< @brief Whether cores was given. */
  233. unsigned int ignore_invalid_hosts_given ; /**< @brief Whether ignore-invalid-hosts was given. */
  234. unsigned int help_given ; /**< @brief Whether help was given. */
  235. unsigned int version_given ; /**< @brief Whether version was given. */
  236. char **inputs ; /**< @brief unamed options (options without names) */
  237. unsigned inputs_num ; /**< @brief unamed options number */
  238. } ;
  239. /** @brief The additional parameters to pass to parser functions */
  240. struct cmdline_parser_params
  241. {
  242. int override; /**< @brief whether to override possibly already present options (default 0) */
  243. int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */
  244. int check_required; /**< @brief whether to check that all required options were provided (default 1) */
  245. int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */
  246. int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */
  247. } ;
  248. /** @brief the purpose string of the program */
  249. extern const char *gengetopt_args_info_purpose;
  250. /** @brief the usage string of the program */
  251. extern const char *gengetopt_args_info_usage;
  252. /** @brief the description string of the program */
  253. extern const char *gengetopt_args_info_description;
  254. /** @brief all the lines making the help output */
  255. extern const char *gengetopt_args_info_help[];
  256. /**
  257. * The command line parser
  258. * @param argc the number of command line options
  259. * @param argv the command line options
  260. * @param args_info the structure where option information will be stored
  261. * @return 0 if everything went fine, NON 0 if an error took place
  262. */
  263. int cmdline_parser (int argc, char **argv,
  264. struct gengetopt_args_info *args_info);
  265. /**
  266. * The command line parser (version with additional parameters - deprecated)
  267. * @param argc the number of command line options
  268. * @param argv the command line options
  269. * @param args_info the structure where option information will be stored
  270. * @param override whether to override possibly already present options
  271. * @param initialize whether to initialize the option structure my_args_info
  272. * @param check_required whether to check that all required options were provided
  273. * @return 0 if everything went fine, NON 0 if an error took place
  274. * @deprecated use cmdline_parser_ext() instead
  275. */
  276. int cmdline_parser2 (int argc, char **argv,
  277. struct gengetopt_args_info *args_info,
  278. int override, int initialize, int check_required);
  279. /**
  280. * The command line parser (version with additional parameters)
  281. * @param argc the number of command line options
  282. * @param argv the command line options
  283. * @param args_info the structure where option information will be stored
  284. * @param params additional parameters for the parser
  285. * @return 0 if everything went fine, NON 0 if an error took place
  286. */
  287. int cmdline_parser_ext (int argc, char **argv,
  288. struct gengetopt_args_info *args_info,
  289. struct cmdline_parser_params *params);
  290. /**
  291. * Save the contents of the option struct into an already open FILE stream.
  292. * @param outfile the stream where to dump options
  293. * @param args_info the option struct to dump
  294. * @return 0 if everything went fine, NON 0 if an error took place
  295. */
  296. int cmdline_parser_dump(FILE *outfile,
  297. struct gengetopt_args_info *args_info);
  298. /**
  299. * Save the contents of the option struct into a (text) file.
  300. * This file can be read by the config file parser (if generated by gengetopt)
  301. * @param filename the file where to save
  302. * @param args_info the option struct to save
  303. * @return 0 if everything went fine, NON 0 if an error took place
  304. */
  305. int cmdline_parser_file_save(const char *filename,
  306. struct gengetopt_args_info *args_info);
  307. /**
  308. * Print the help
  309. */
  310. void cmdline_parser_print_help(void);
  311. /**
  312. * Print the version
  313. */
  314. void cmdline_parser_print_version(void);
  315. /**
  316. * Initializes all the fields a cmdline_parser_params structure
  317. * to their default values
  318. * @param params the structure to initialize
  319. */
  320. void cmdline_parser_params_init(struct cmdline_parser_params *params);
  321. /**
  322. * Allocates dynamically a cmdline_parser_params structure and initializes
  323. * all its fields to their default values
  324. * @return the created and initialized cmdline_parser_params structure
  325. */
  326. struct cmdline_parser_params *cmdline_parser_params_create(void);
  327. /**
  328. * Initializes the passed gengetopt_args_info structure's fields
  329. * (also set default values for options that have a default)
  330. * @param args_info the structure to initialize
  331. */
  332. void cmdline_parser_init (struct gengetopt_args_info *args_info);
  333. /**
  334. * Deallocates the string fields of the gengetopt_args_info structure
  335. * (but does not deallocate the structure itself)
  336. * @param args_info the structure to deallocate
  337. */
  338. void cmdline_parser_free (struct gengetopt_args_info *args_info);
  339. /**
  340. * The config file parser (deprecated version)
  341. * @param filename the name of the config file
  342. * @param args_info the structure where option information will be stored
  343. * @param override whether to override possibly already present options
  344. * @param initialize whether to initialize the option structure my_args_info
  345. * @param check_required whether to check that all required options were provided
  346. * @return 0 if everything went fine, NON 0 if an error took place
  347. * @deprecated use cmdline_parser_config_file() instead
  348. */
  349. int cmdline_parser_configfile (const char *filename,
  350. struct gengetopt_args_info *args_info,
  351. int override, int initialize, int check_required);
  352. /**
  353. * The config file parser
  354. * @param filename the name of the config file
  355. * @param args_info the structure where option information will be stored
  356. * @param params additional parameters for the parser
  357. * @return 0 if everything went fine, NON 0 if an error took place
  358. */
  359. int cmdline_parser_config_file (const char *filename,
  360. struct gengetopt_args_info *args_info,
  361. struct cmdline_parser_params *params);
  362. /**
  363. * Checks that all the required options were specified
  364. * @param args_info the structure to check
  365. * @param prog_name the name of the program that will be used to print
  366. * possible errors
  367. * @return
  368. */
  369. int cmdline_parser_required (struct gengetopt_args_info *args_info,
  370. const char *prog_name);
  371. #ifdef __cplusplus
  372. }
  373. #endif /* __cplusplus */
  374. #endif /* ZOPT_H */