IP to Geo

IP to Geo Git Source Tree

Root/src/cmdline.h

1/** @file cmdline.h
2 * @brief The header file for the command line option parser
3 * generated by GNU Gengetopt version 2.22.5
4 * http://www.gnu.org/software/gengetopt.
5 * DO NOT modify this file, since it can be overwritten
6 * @author GNU Gengetopt by Lorenzo Bettini */
7
8#ifndef CMDLINE_H
9#define CMDLINE_H
10
11/* If we use autoconf. */
12#ifdef HAVE_CONFIG_H
13#include "config.h"
14#endif
15
16#include <stdio.h> /* for FILE */
17
18#ifdef __cplusplus
19extern "C" {
20#endif /* __cplusplus */
21
22#ifndef CMDLINE_PARSER_PACKAGE
23/** @brief the program name (used for printing errors) */
24#define CMDLINE_PARSER_PACKAGE "ip_to_geo"
25#endif
26
27#ifndef CMDLINE_PARSER_PACKAGE_NAME
28/** @brief the complete program name (used for help and version) */
29#define CMDLINE_PARSER_PACKAGE_NAME "ip_to_geo"
30#endif
31
32#ifndef CMDLINE_PARSER_VERSION
33/** @brief the program version */
34#define CMDLINE_PARSER_VERSION "0.1"
35#endif
36
37/** @brief Where the command line options are stored */
38struct gengetopt_args_info
39{
40 const char *help_help; /**< @brief Print help and exit help description. */
41 const char *version_help; /**< @brief Print version and exit help description. */
42 char * ip_arg;/**< @brief IP to convert. */
43 char * ip_orig;/**< @brief IP to convert original value given at command line. */
44 const char *ip_help; /**< @brief IP to convert help description. */
45 int quiet_flag;/**< @brief Quiet mode (default=off). */
46 const char *quiet_help; /**< @brief Quiet mode help description. */
47 int verbose_flag;/**< @brief Verbose mode (default=off). */
48 const char *verbose_help; /**< @brief Verbose mode help description. */
49 int daemon_flag;/**< @brief Daemonize (default=off). */
50 const char *daemon_help; /**< @brief Daemonize help description. */
51 int port_arg;/**< @brief Port (default='53333'). */
52 char * port_orig;/**< @brief Port original value given at command line. */
53 const char *port_help; /**< @brief Port help description. */
54 char * bind_ip_arg;/**< @brief IP to bind to. */
55 char * bind_ip_orig;/**< @brief IP to bind to original value given at command line. */
56 const char *bind_ip_help; /**< @brief IP to bind to help description. */
57 int no_background_flag;/**< @brief Don't go to background for daemon mode (default=off). */
58 const char *no_background_help; /**< @brief Don't go to background for daemon mode help description. */
59 int sockets_per_thread_arg;/**< @brief Number of sockets managed by a single thread (default='10'). */
60 char * sockets_per_thread_orig;/**< @brief Number of sockets managed by a single thread original value given at command line. */
61 const char *sockets_per_thread_help; /**< @brief Number of sockets managed by a single thread help description. */
62 int sockets_timeout_arg;/**< @brief Close connection after X seconds (default='5'). */
63 char * sockets_timeout_orig;/**< @brief Close connection after X seconds original value given at command line. */
64 const char *sockets_timeout_help; /**< @brief Close connection after X seconds help description. */
65 int client_max_requests_arg;/**< @brief Number of requests allowed for one client (default='100'). */
66 char * client_max_requests_orig;/**< @brief Number of requests allowed for one client original value given at command line. */
67 const char *client_max_requests_help; /**< @brief Number of requests allowed for one client help description. */
68
69 unsigned int help_given ;/**< @brief Whether help was given. */
70 unsigned int version_given ;/**< @brief Whether version was given. */
71 unsigned int ip_given ;/**< @brief Whether ip was given. */
72 unsigned int quiet_given ;/**< @brief Whether quiet was given. */
73 unsigned int verbose_given ;/**< @brief Whether verbose was given. */
74 unsigned int daemon_given ;/**< @brief Whether daemon was given. */
75 unsigned int port_given ;/**< @brief Whether port was given. */
76 unsigned int bind_ip_given ;/**< @brief Whether bind-ip was given. */
77 unsigned int no_background_given ;/**< @brief Whether no-background was given. */
78 unsigned int sockets_per_thread_given ;/**< @brief Whether sockets-per-thread was given. */
79 unsigned int sockets_timeout_given ;/**< @brief Whether sockets-timeout was given. */
80 unsigned int client_max_requests_given ;/**< @brief Whether client-max-requests was given. */
81
82} ;
83
84/** @brief The additional parameters to pass to parser functions */
85struct cmdline_parser_params
86{
87 int override; /**< @brief whether to override possibly already present options (default 0) */
88 int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */
89 int check_required; /**< @brief whether to check that all required options were provided (default 1) */
90 int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */
91 int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */
92} ;
93
94/** @brief the purpose string of the program */
95extern const char *gengetopt_args_info_purpose;
96/** @brief the usage string of the program */
97extern const char *gengetopt_args_info_usage;
98/** @brief all the lines making the help output */
99extern const char *gengetopt_args_info_help[];
100
101/**
102 * The command line parser
103 * @param argc the number of command line options
104 * @param argv the command line options
105 * @param args_info the structure where option information will be stored
106 * @return 0 if everything went fine, NON 0 if an error took place
107 */
108int cmdline_parser (int argc, char **argv,
109 struct gengetopt_args_info *args_info);
110
111/**
112 * The command line parser (version with additional parameters - deprecated)
113 * @param argc the number of command line options
114 * @param argv the command line options
115 * @param args_info the structure where option information will be stored
116 * @param override whether to override possibly already present options
117 * @param initialize whether to initialize the option structure my_args_info
118 * @param check_required whether to check that all required options were provided
119 * @return 0 if everything went fine, NON 0 if an error took place
120 * @deprecated use cmdline_parser_ext() instead
121 */
122int cmdline_parser2 (int argc, char **argv,
123 struct gengetopt_args_info *args_info,
124 int override, int initialize, int check_required);
125
126/**
127 * The command line parser (version with additional parameters)
128 * @param argc the number of command line options
129 * @param argv the command line options
130 * @param args_info the structure where option information will be stored
131 * @param params additional parameters for the parser
132 * @return 0 if everything went fine, NON 0 if an error took place
133 */
134int cmdline_parser_ext (int argc, char **argv,
135 struct gengetopt_args_info *args_info,
136 struct cmdline_parser_params *params);
137
138/**
139 * Save the contents of the option struct into an already open FILE stream.
140 * @param outfile the stream where to dump options
141 * @param args_info the option struct to dump
142 * @return 0 if everything went fine, NON 0 if an error took place
143 */
144int cmdline_parser_dump(FILE *outfile,
145 struct gengetopt_args_info *args_info);
146
147/**
148 * Save the contents of the option struct into a (text) file.
149 * This file can be read by the config file parser (if generated by gengetopt)
150 * @param filename the file where to save
151 * @param args_info the option struct to save
152 * @return 0 if everything went fine, NON 0 if an error took place
153 */
154int cmdline_parser_file_save(const char *filename,
155 struct gengetopt_args_info *args_info);
156
157/**
158 * Print the help
159 */
160void cmdline_parser_print_help(void);
161/**
162 * Print the version
163 */
164void cmdline_parser_print_version(void);
165
166/**
167 * Initializes all the fields a cmdline_parser_params structure
168 * to their default values
169 * @param params the structure to initialize
170 */
171void cmdline_parser_params_init(struct cmdline_parser_params *params);
172
173/**
174 * Allocates dynamically a cmdline_parser_params structure and initializes
175 * all its fields to their default values
176 * @return the created and initialized cmdline_parser_params structure
177 */
178struct cmdline_parser_params *cmdline_parser_params_create(void);
179
180/**
181 * Initializes the passed gengetopt_args_info structure's fields
182 * (also set default values for options that have a default)
183 * @param args_info the structure to initialize
184 */
185void cmdline_parser_init (struct gengetopt_args_info *args_info);
186/**
187 * Deallocates the string fields of the gengetopt_args_info structure
188 * (but does not deallocate the structure itself)
189 * @param args_info the structure to deallocate
190 */
191void cmdline_parser_free (struct gengetopt_args_info *args_info);
192
193/**
194 * Checks that all the required options were specified
195 * @param args_info the structure to check
196 * @param prog_name the name of the program that will be used to print
197 * possible errors
198 * @return
199 */
200int cmdline_parser_required (struct gengetopt_args_info *args_info,
201 const char *prog_name);
202
203
204#ifdef __cplusplus
205}
206#endif /* __cplusplus */
207#endif /* CMDLINE_H */

Archive Download this file

Branches

Tags