1 #ifndef _IPXE_PARSEOPT_H 2 #define _IPXE_PARSEOPT_H 49 #define OPTION_PARSER( _struct, _field, _parse ) \ 50 ( ( int ( * ) ( char *text, void *value ) ) \ 51 ( ( ( ( typeof ( _parse ) * ) NULL ) == \ 52 ( ( int ( * ) ( char *text, \ 53 typeof ( ( ( _struct * ) NULL )->_field ) * ) ) \ 54 NULL ) ) ? _parse : _parse ) ) 67 #define OPTION_DESC( _longopt, _shortopt, _has_arg, _struct, _field, _parse ) \ 69 .longopt = _longopt, \ 70 .shortopt = _shortopt, \ 71 .has_arg = _has_arg, \ 72 .offset = offsetof ( _struct, _field ), \ 73 .parse = OPTION_PARSER ( _struct, _field, _parse ), \ 97 #define MAX_ARGUMENTS 0xff 108 #define COMMAND_DESC( _struct, _options, _min_args, _max_args, _usage ) \ 110 .options = ( ( ( ( typeof ( _options[0] ) * ) NULL ) == \ 111 ( ( struct option_descriptor * ) NULL ) ) ? \ 112 _options : _options ), \ 113 .num_options = ( sizeof ( _options ) / \ 114 sizeof ( _options[0] ) ), \ 115 .len = sizeof ( _struct ), \ 116 .min_args = _min_args, \ 117 .max_args = _max_args, \ int parse_key(char *text, unsigned int *key)
Parse key.
int parse_options(int argc, char **argv, struct command_descriptor *cmd, void *opts)
Parse command-line options.
A UUID command-line option.
int parse_autovivified_setting(char *text, struct named_setting *setting)
Parse and autovivify setting name.
uint8_t min_args
Minimum number of non-option arguments.
A request parameter list.
uint8_t has_arg
Argument requirement (as for struct option)
int parse_timeout(char *text, unsigned long *value)
Parse timeout value (in ms)
const char * longopt
Long option name, if any.
int parse_flag(char *text __unused, int *flag)
Parse flag.
int parse_setting(char *text, struct named_setting *setting, get_child_settings_t get_child)
Parse setting name.
int(* parse)(char *text, void *value)
Parse option.
uint16_t offset
Offset of field within options structure.
#define __unused
Declare a variable or data structure as unused.
char shortopt
Short option name.
int parse_parameters(char *text, struct parameters **params)
Parse request parameter list name.
const char * usage
Command usage.
struct settings *(* get_child_settings_t)(struct settings *settings, const char *name)
A child settings block locator function.
pseudo_bit_t value[0x00020]
uint8_t num_options
Number of option descriptors.
void print_usage(struct command_descriptor *cmd, char **argv)
Print command usage message.
static struct net_device * netdev
int parse_string(char *text, char **value)
Parse string value.
struct settings * settings
Settings block.
int parse_settings(char *text, struct settings **settings)
Parse settings block name.
int reparse_options(int argc, char **argv, struct command_descriptor *cmd, void *opts)
Reparse command-line options.
int parse_netdev_configurator(char *text, struct net_device_configurator **configurator)
Parse network device configurator name.
uint8_t len
Length of option structure.
A dynamic user interface.
struct option_descriptor * options
Option descriptors.
int parse_existing_setting(char *text, struct named_setting *setting)
Parse existing setting name.
int parse_netdev(char *text, struct net_device **netdev)
Parse network device name.
A network device configurator.
int parse_integer(char *text, unsigned int *value)
Parse integer value.
A command-line option descriptor.
union uuid buf
Storage buffer.
int parse_uuid(char *text, struct uuid_option *uuid)
Parse UUID.
uint32_t flag
Flag number.
static union @438 opts
"cert<xxx>" option list
int parse_dynui(char *text, struct dynamic_ui **dynui)
Parse dynamic user interface name.
uint8_t max_args
Maximum number of non-option arguments.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)