~ubuntu-branches/ubuntu/vivid/libu2f-server/vivid

« back to all changes in this revision

Viewing changes to src/cmdline.h

  • Committer: Package Import Robot
  • Author(s): Alessio Di Mauro
  • Date: 2015-01-22 22:41:48 UTC
  • Revision ID: package-import@ubuntu.com-20150122224148-wbg8eu2ykxbat244
Tags: upstream-0.0.0
ImportĀ upstreamĀ versionĀ 0.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 */
 
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
 
19
extern "C" {
 
20
#endif                          /* __cplusplus */
 
21
 
 
22
#ifndef CMDLINE_PARSER_PACKAGE
 
23
/** @brief the program name (used for printing errors) */
 
24
#define CMDLINE_PARSER_PACKAGE PACKAGE
 
25
#endif
 
26
 
 
27
#ifndef CMDLINE_PARSER_PACKAGE_NAME
 
28
/** @brief the complete program name (used for help and version) */
 
29
#ifdef PACKAGE_NAME
 
30
#define CMDLINE_PARSER_PACKAGE_NAME PACKAGE_NAME
 
31
#else
 
32
#define CMDLINE_PARSER_PACKAGE_NAME PACKAGE
 
33
#endif
 
34
#endif
 
35
 
 
36
#ifndef CMDLINE_PARSER_VERSION
 
37
/** @brief the program version */
 
38
#define CMDLINE_PARSER_VERSION VERSION
 
39
#endif
 
40
 
 
41
  enum enum_action { action__NULL = -1, action_arg_register =
 
42
        0, action_arg_authenticate
 
43
  };
 
44
 
 
45
/** @brief Where the command line options are stored */
 
46
  struct gengetopt_args_info {
 
47
    const char *help_help;
 
48
                         /**< @brief Print help and exit help description.  */
 
49
    const char *version_help;
 
50
                            /**< @brief Print version and exit help description.  */
 
51
    char *origin_arg;   /**< @brief Origin URL to use..  */
 
52
    char *origin_orig;  /**< @brief Origin URL to use. original value given at command line.  */
 
53
    const char *origin_help;
 
54
                           /**< @brief Origin URL to use. help description.  */
 
55
    char *appid_arg;    /**< @brief Application ID to use..  */
 
56
    char *appid_orig;   /**< @brief Application ID to use. original value given at command line.  */
 
57
    const char *appid_help;
 
58
                          /**< @brief Application ID to use. help description.  */
 
59
    char *challenge_arg;/**< @brief Challenge (Base64-URL encoded) string to use..  */
 
60
    char *challenge_orig;       /**< @brief Challenge (Base64-URL encoded) string to use. original value given at command line.  */
 
61
    const char *challenge_help;
 
62
                              /**< @brief Challenge (Base64-URL encoded) string to use. help description.  */
 
63
    enum enum_action action_arg;/**< @brief Action to take..  */
 
64
    char *action_orig;  /**< @brief Action to take. original value given at command line.  */
 
65
    const char *action_help;
 
66
                           /**< @brief Action to take. help description.  */
 
67
    char *key_handle_arg;       /**< @brief A file containing a key-handle.  */
 
68
    char *key_handle_orig;      /**< @brief A file containing a key-handle original value given at command line.  */
 
69
    const char *key_handle_help;
 
70
                               /**< @brief A file containing a key-handle help description.  */
 
71
    char *user_key_arg; /**< @brief A file containing the public user-key.  */
 
72
    char *user_key_orig;/**< @brief A file containing the public user-key original value given at command line.  */
 
73
    const char *user_key_help;
 
74
                             /**< @brief A file containing the public user-key help description.  */
 
75
    int debug_flag;     /**< @brief Print debug information to standard error (default=off).  */
 
76
    const char *debug_help;
 
77
                          /**< @brief Print debug information to standard error help description.  */
 
78
 
 
79
    unsigned int help_given;    /**< @brief Whether help was given.  */
 
80
    unsigned int version_given; /**< @brief Whether version was given.  */
 
81
    unsigned int origin_given;  /**< @brief Whether origin was given.  */
 
82
    unsigned int appid_given;   /**< @brief Whether appid was given.  */
 
83
    unsigned int challenge_given;       /**< @brief Whether challenge was given.  */
 
84
    unsigned int action_given;  /**< @brief Whether action was given.  */
 
85
    unsigned int key_handle_given;      /**< @brief Whether key-handle was given.  */
 
86
    unsigned int user_key_given;/**< @brief Whether user-key was given.  */
 
87
    unsigned int debug_given;   /**< @brief Whether debug was given.  */
 
88
 
 
89
  };
 
90
 
 
91
/** @brief The additional parameters to pass to parser functions */
 
92
  struct cmdline_parser_params {
 
93
    int override;
 
94
                /**< @brief whether to override possibly already present options (default 0) */
 
95
    int initialize;
 
96
                  /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */
 
97
    int check_required;
 
98
                      /**< @brief whether to check that all required options were provided (default 1) */
 
99
    int check_ambiguity;
 
100
                       /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */
 
101
    int print_errors;
 
102
                    /**< @brief whether getopt_long should print an error message for a bad option (default 1) */
 
103
  };
 
104
 
 
105
/** @brief the purpose string of the program */
 
106
  extern const char *gengetopt_args_info_purpose;
 
107
/** @brief the usage string of the program */
 
108
  extern const char *gengetopt_args_info_usage;
 
109
/** @brief the description string of the program */
 
110
  extern const char *gengetopt_args_info_description;
 
111
/** @brief all the lines making the help output */
 
112
  extern const char *gengetopt_args_info_help[];
 
113
 
 
114
/**
 
115
 * The command line parser
 
116
 * @param argc the number of command line options
 
117
 * @param argv the command line options
 
118
 * @param args_info the structure where option information will be stored
 
119
 * @return 0 if everything went fine, NON 0 if an error took place
 
120
 */
 
121
  int cmdline_parser(int argc, char **argv,
 
122
                     struct gengetopt_args_info *args_info);
 
123
 
 
124
/**
 
125
 * The command line parser (version with additional parameters - deprecated)
 
126
 * @param argc the number of command line options
 
127
 * @param argv the command line options
 
128
 * @param args_info the structure where option information will be stored
 
129
 * @param override whether to override possibly already present options
 
130
 * @param initialize whether to initialize the option structure my_args_info
 
131
 * @param check_required whether to check that all required options were provided
 
132
 * @return 0 if everything went fine, NON 0 if an error took place
 
133
 * @deprecated use cmdline_parser_ext() instead
 
134
 */
 
135
  int cmdline_parser2(int argc, char **argv,
 
136
                      struct gengetopt_args_info *args_info,
 
137
                      int override, int initialize, int check_required);
 
138
 
 
139
/**
 
140
 * The command line parser (version with additional parameters)
 
141
 * @param argc the number of command line options
 
142
 * @param argv the command line options
 
143
 * @param args_info the structure where option information will be stored
 
144
 * @param params additional parameters for the parser
 
145
 * @return 0 if everything went fine, NON 0 if an error took place
 
146
 */
 
147
  int cmdline_parser_ext(int argc, char **argv,
 
148
                         struct gengetopt_args_info *args_info,
 
149
                         struct cmdline_parser_params *params);
 
150
 
 
151
/**
 
152
 * Save the contents of the option struct into an already open FILE stream.
 
153
 * @param outfile the stream where to dump options
 
154
 * @param args_info the option struct to dump
 
155
 * @return 0 if everything went fine, NON 0 if an error took place
 
156
 */
 
157
  int cmdline_parser_dump(FILE * outfile,
 
158
                          struct gengetopt_args_info *args_info);
 
159
 
 
160
/**
 
161
 * Save the contents of the option struct into a (text) file.
 
162
 * This file can be read by the config file parser (if generated by gengetopt)
 
163
 * @param filename the file where to save
 
164
 * @param args_info the option struct to save
 
165
 * @return 0 if everything went fine, NON 0 if an error took place
 
166
 */
 
167
  int cmdline_parser_file_save(const char *filename,
 
168
                               struct gengetopt_args_info *args_info);
 
169
 
 
170
/**
 
171
 * Print the help
 
172
 */
 
173
  void cmdline_parser_print_help(void);
 
174
/**
 
175
 * Print the version
 
176
 */
 
177
  void cmdline_parser_print_version(void);
 
178
 
 
179
/**
 
180
 * Initializes all the fields a cmdline_parser_params structure 
 
181
 * to their default values
 
182
 * @param params the structure to initialize
 
183
 */
 
184
  void cmdline_parser_params_init(struct cmdline_parser_params *params);
 
185
 
 
186
/**
 
187
 * Allocates dynamically a cmdline_parser_params structure and initializes
 
188
 * all its fields to their default values
 
189
 * @return the created and initialized cmdline_parser_params structure
 
190
 */
 
191
  struct cmdline_parser_params *cmdline_parser_params_create(void);
 
192
 
 
193
/**
 
194
 * Initializes the passed gengetopt_args_info structure's fields
 
195
 * (also set default values for options that have a default)
 
196
 * @param args_info the structure to initialize
 
197
 */
 
198
  void cmdline_parser_init(struct gengetopt_args_info *args_info);
 
199
/**
 
200
 * Deallocates the string fields of the gengetopt_args_info structure
 
201
 * (but does not deallocate the structure itself)
 
202
 * @param args_info the structure to deallocate
 
203
 */
 
204
  void cmdline_parser_free(struct gengetopt_args_info *args_info);
 
205
 
 
206
/**
 
207
 * Checks that all the required options were specified
 
208
 * @param args_info the structure to check
 
209
 * @param prog_name the name of the program that will be used to print
 
210
 *   possible errors
 
211
 * @return
 
212
 */
 
213
  int cmdline_parser_required(struct gengetopt_args_info *args_info,
 
214
                              const char *prog_name);
 
215
 
 
216
  extern const char *cmdline_parser_action_values[];/**< @brief Possible values for action. */
 
217
 
 
218
 
 
219
#ifdef __cplusplus
 
220
}
 
221
#endif                          /* __cplusplus */
 
222
#endif                          /* CMDLINE_H */