Statistics
| Branch: | Revision:

janus-gateway / cmdline.h @ 5e9e29e0

History | View | Annotate | Download (10.7 KB)

1 be35facb meetecho
/** @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
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 "janus"
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 "janus"
30
#endif
31
32
#ifndef CMDLINE_PARSER_VERSION
33
/** @brief the program version */
34
#define CMDLINE_PARSER_VERSION "0.0.1"
35
#endif
36
37
/** @brief Where the command line options are stored */
38
struct 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 * interface_arg;        /**< @brief Interface to use (will be the public IP).  */
43
  char * interface_orig;        /**< @brief Interface to use (will be the public IP) original value given at command line.  */
44
  const char *interface_help; /**< @brief Interface to use (will be the public IP) help description.  */
45
  int port_arg;        /**< @brief Web server HTTP port (default=8088).  */
46
  char * port_orig;        /**< @brief Web server HTTP port (default=8088) original value given at command line.  */
47
  const char *port_help; /**< @brief Web server HTTP port (default=8088) help description.  */
48
  int secure_port_arg;        /**< @brief Web server HTTPS port (default=no HTTPS).  */
49
  char * secure_port_orig;        /**< @brief Web server HTTPS port (default=no HTTPS) original value given at command line.  */
50
  const char *secure_port_help; /**< @brief Web server HTTPS port (default=no HTTPS) help description.  */
51
  int no_http_flag;        /**< @brief Disable insecure HTTP web server (default=off).  */
52
  const char *no_http_help; /**< @brief Disable insecure HTTP web server help description.  */
53
  char * base_path_arg;        /**< @brief Base path to bind to in the web server (default=/janus) .  */
54
  char * base_path_orig;        /**< @brief Base path to bind to in the web server (default=/janus)  original value given at command line.  */
55
  const char *base_path_help; /**< @brief Base path to bind to in the web server (default=/janus)  help description.  */
56
  char * plugins_folder_arg;        /**< @brief Plugins folder (default=./plugins).  */
57
  char * plugins_folder_orig;        /**< @brief Plugins folder (default=./plugins) original value given at command line.  */
58
  const char *plugins_folder_help; /**< @brief Plugins folder (default=./plugins) help description.  */
59
  char * config_arg;        /**< @brief Configuration file to use.  */
60
  char * config_orig;        /**< @brief Configuration file to use original value given at command line.  */
61
  const char *config_help; /**< @brief Configuration file to use help description.  */
62
  char * configs_folder_arg;        /**< @brief Configuration files folder (default=./conf).  */
63
  char * configs_folder_orig;        /**< @brief Configuration files folder (default=./conf) original value given at command line.  */
64
  const char *configs_folder_help; /**< @brief Configuration files folder (default=./conf) help description.  */
65
  char * cert_pem_arg;        /**< @brief HTTPS/DTLS certificate.  */
66
  char * cert_pem_orig;        /**< @brief HTTPS/DTLS certificate original value given at command line.  */
67
  const char *cert_pem_help; /**< @brief HTTPS/DTLS certificate help description.  */
68
  char * cert_key_arg;        /**< @brief HTTPS/DTLS certificate key.  */
69
  char * cert_key_orig;        /**< @brief HTTPS/DTLS certificate key original value given at command line.  */
70
  const char *cert_key_help; /**< @brief HTTPS/DTLS certificate key help description.  */
71
  char * stun_server_arg;        /**< @brief STUN server(:port) to use, if needed (e.g., gateway behind NAT, default=none).  */
72
  char * stun_server_orig;        /**< @brief STUN server(:port) to use, if needed (e.g., gateway behind NAT, default=none) original value given at command line.  */
73
  const char *stun_server_help; /**< @brief STUN server(:port) to use, if needed (e.g., gateway behind NAT, default=none) help description.  */
74 5e9e29e0 meetecho
  char * public_ip_arg;        /**< @brief Public address of the machine, to use in SDP.  */
75
  char * public_ip_orig;        /**< @brief Public address of the machine, to use in SDP original value given at command line.  */
76
  const char *public_ip_help; /**< @brief Public address of the machine, to use in SDP help description.  */
77
  char * rtp_port_range_arg;        /**< @brief Port range to use for RTP/RTCP.  */
78
  char * rtp_port_range_orig;        /**< @brief Port range to use for RTP/RTCP original value given at command line.  */
79
  const char *rtp_port_range_help; /**< @brief Port range to use for RTP/RTCP help description.  */
80 be35facb meetecho
  
81
  unsigned int help_given ;        /**< @brief Whether help was given.  */
82
  unsigned int version_given ;        /**< @brief Whether version was given.  */
83
  unsigned int interface_given ;        /**< @brief Whether interface was given.  */
84
  unsigned int port_given ;        /**< @brief Whether port was given.  */
85
  unsigned int secure_port_given ;        /**< @brief Whether secure-port was given.  */
86
  unsigned int no_http_given ;        /**< @brief Whether no-http was given.  */
87
  unsigned int base_path_given ;        /**< @brief Whether base-path was given.  */
88
  unsigned int plugins_folder_given ;        /**< @brief Whether plugins-folder was given.  */
89
  unsigned int config_given ;        /**< @brief Whether config was given.  */
90
  unsigned int configs_folder_given ;        /**< @brief Whether configs-folder was given.  */
91
  unsigned int cert_pem_given ;        /**< @brief Whether cert-pem was given.  */
92
  unsigned int cert_key_given ;        /**< @brief Whether cert-key was given.  */
93
  unsigned int stun_server_given ;        /**< @brief Whether stun-server was given.  */
94 5e9e29e0 meetecho
  unsigned int public_ip_given ;        /**< @brief Whether public-ip was given.  */
95
  unsigned int rtp_port_range_given ;        /**< @brief Whether rtp-port-range was given.  */
96 be35facb meetecho
97
} ;
98
99
/** @brief The additional parameters to pass to parser functions */
100
struct cmdline_parser_params
101
{
102
  int override; /**< @brief whether to override possibly already present options (default 0) */
103
  int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */
104
  int check_required; /**< @brief whether to check that all required options were provided (default 1) */
105
  int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */
106
  int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */
107
} ;
108
109
/** @brief the purpose string of the program */
110
extern const char *gengetopt_args_info_purpose;
111
/** @brief the usage string of the program */
112
extern const char *gengetopt_args_info_usage;
113
/** @brief all the lines making the help output */
114
extern const char *gengetopt_args_info_help[];
115
116
/**
117
 * The command line parser
118
 * @param argc the number of command line options
119
 * @param argv the command line options
120
 * @param args_info the structure where option information will be stored
121
 * @return 0 if everything went fine, NON 0 if an error took place
122
 */
123
int cmdline_parser (int argc, char **argv,
124
  struct gengetopt_args_info *args_info);
125
126
/**
127
 * The command line parser (version with additional parameters - deprecated)
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 override whether to override possibly already present options
132
 * @param initialize whether to initialize the option structure my_args_info
133
 * @param check_required whether to check that all required options were provided
134
 * @return 0 if everything went fine, NON 0 if an error took place
135
 * @deprecated use cmdline_parser_ext() instead
136
 */
137
int cmdline_parser2 (int argc, char **argv,
138
  struct gengetopt_args_info *args_info,
139
  int override, int initialize, int check_required);
140
141
/**
142
 * The command line parser (version with additional parameters)
143
 * @param argc the number of command line options
144
 * @param argv the command line options
145
 * @param args_info the structure where option information will be stored
146
 * @param params additional parameters for the parser
147
 * @return 0 if everything went fine, NON 0 if an error took place
148
 */
149
int cmdline_parser_ext (int argc, char **argv,
150
  struct gengetopt_args_info *args_info,
151
  struct cmdline_parser_params *params);
152
153
/**
154
 * Save the contents of the option struct into an already open FILE stream.
155
 * @param outfile the stream where to dump options
156
 * @param args_info the option struct to dump
157
 * @return 0 if everything went fine, NON 0 if an error took place
158
 */
159
int cmdline_parser_dump(FILE *outfile,
160
  struct gengetopt_args_info *args_info);
161
162
/**
163
 * Save the contents of the option struct into a (text) file.
164
 * This file can be read by the config file parser (if generated by gengetopt)
165
 * @param filename the file where to save
166
 * @param args_info the option struct to save
167
 * @return 0 if everything went fine, NON 0 if an error took place
168
 */
169
int cmdline_parser_file_save(const char *filename,
170
  struct gengetopt_args_info *args_info);
171
172
/**
173
 * Print the help
174
 */
175
void cmdline_parser_print_help(void);
176
/**
177
 * Print the version
178
 */
179
void cmdline_parser_print_version(void);
180
181
/**
182
 * Initializes all the fields a cmdline_parser_params structure 
183
 * to their default values
184
 * @param params the structure to initialize
185
 */
186
void cmdline_parser_params_init(struct cmdline_parser_params *params);
187
188
/**
189
 * Allocates dynamically a cmdline_parser_params structure and initializes
190
 * all its fields to their default values
191
 * @return the created and initialized cmdline_parser_params structure
192
 */
193
struct cmdline_parser_params *cmdline_parser_params_create(void);
194
195
/**
196
 * Initializes the passed gengetopt_args_info structure's fields
197
 * (also set default values for options that have a default)
198
 * @param args_info the structure to initialize
199
 */
200
void cmdline_parser_init (struct gengetopt_args_info *args_info);
201
/**
202
 * Deallocates the string fields of the gengetopt_args_info structure
203
 * (but does not deallocate the structure itself)
204
 * @param args_info the structure to deallocate
205
 */
206
void cmdline_parser_free (struct gengetopt_args_info *args_info);
207
208
/**
209
 * Checks that all the required options were specified
210
 * @param args_info the structure to check
211
 * @param prog_name the name of the program that will be used to print
212
 *   possible errors
213
 * @return
214
 */
215
int cmdline_parser_required (struct gengetopt_args_info *args_info,
216
  const char *prog_name);
217
218
219
#ifdef __cplusplus
220
}
221
#endif /* __cplusplus */
222
#endif /* CMDLINE_H */