 |
Flowgrind
Advanced TCP traffic generator
|
Go to the documentation of this file.
29 #ifndef _ARG_PARSER_H_
30 #define _ARG_PARSER_H_
112 const int argc,
const char *
const argv[],
113 const struct ap_Option options[],
const char in_order);
216 const int i,
int *conflict);
242 const int i,
int *conflict);
int error_size
Real size of the error string.
int * seen_records
A table containing for each mutex the last seen option record.
Internal state of the argument parser.
ap_Has_arg
Specifies whether a command line option needs an argument.
@ ap_no
Option without argument (flag).
int * mutex
Null-terminated array of mutex IDs (greater zero) this option belongs to.
const struct ap_Option * ap_option(const struct arg_parser *const ap, const int i)
Get the user-defined option for a given record position.
int num_mutex
The number of defined mutex.
bool ap_set_check_mutex(const struct arg_parser *const ap, struct ap_Mutex_state *const ms, const int i, int *conflict)
Check a new option record for mutex and register it at the same time.
enum ap_Has_arg has_arg
Argument specifier.
bool ap_init(struct arg_parser *const ap, const int argc, const char *const argv[], const struct ap_Option options[], const char in_order)
Initialize the arg-parser given command line and user-defined options.
int ap_code(const struct arg_parser *const ap, const int i)
Returns the code of a parsed option with given index.
struct ap_Record * data
Container for parsed cmdline options.
@ ap_yes
Argument required.
Contains the state of all mutex.
int code
Short option letter or code (code != 0).
int data_size
Number of parsed records.
void ap_reset_mutex(struct ap_Mutex_state *const ms)
Reset a mutex context.
int tag
User tag for distinction of options.
int num_options
Number of known options.
bool ap_is_used(const struct arg_parser *const ap, int code)
Returns true if the option specified by code was given at least once.
void ap_free_mutex_state(struct ap_Mutex_state *const ms)
Free a mutex context.
const char * ap_error(const struct arg_parser *const ap)
Get the string containing errors encountered during parsing.
char * argument
Argument string (may be empty).
const char * ap_opt_string(const struct arg_parser *const ap, const int i)
Get the real command line option string (may be the short or long version).
Defines a valid command line option.
char * error
Contains errors encountered during parsing.
char * name
Long option name (maybe null).
bool ap_init_mutex_state(const struct arg_parser *const ap, struct ap_Mutex_state *const ms)
Initialize a new mutex state table.
const char * ap_argument(const struct arg_parser *const ap, const int i)
Returns the argument of a parsed option.
void ap_free(struct arg_parser *const ap)
Free internal state of arg-parser.
int option_index
Index of the option for internal use (e.g.
@ ap_maybe
Optional Argument.
int num_mutex
The number of defined mutex.
bool ap_set_mutex(const struct arg_parser *const ap, struct ap_Mutex_state *const ms, const int i)
Register an option record in a mutex context.
struct ap_Option * options
Array containing user-defined options.
bool ap_check_mutex(const struct arg_parser *const ap, const struct ap_Mutex_state *const ms, const int i, int *conflict)
Check a new option record for mutex.
char * opt_string
Observed opt string (maybe the long or the short version).
Holds a parsed command line option and its argument.
int ap_arguments(const struct arg_parser *const ap)
Number of arguments parsed (may be different from argc).