DPDK 26.07.0
 
Loading...
Searching...
No Matches
rte_argparse.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2024 HiSilicon Limited
3 */
4
5#ifndef RTE_ARGPARSE_H
6#define RTE_ARGPARSE_H
7
28
29#include <stdbool.h>
30#include <stdint.h>
31
32#include <rte_bitops.h>
33#include <rte_compat.h>
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
50
74
80
91 const char *name_long;
98 const char *name_short;
99
101 const char *help;
102
119 void *val_set;
120
125
127 uint32_t flags;
128};
129
144typedef int (*rte_arg_parser_t)(uint32_t index, const char *value, void *opaque);
145
151 const char *prog_name;
153 const char *usage;
155 const char *descriptor;
157 const char *epilog;
164 /* reserved for future flags/other use */
165 bool reserved_flags[6];
169 void *opaque;
174 void (*print_help)(const struct rte_argparse *obj);
176 void *reserved[15];
179};
180
181#define ARGPARSE_ARG_END() { NULL }
182
201__rte_experimental
202int rte_argparse_parse(const struct rte_argparse *obj, int argc, char **argv);
203
215__rte_experimental
216void rte_argparse_print_help(FILE *stream, const struct rte_argparse *obj);
217
234__rte_experimental
235int rte_argparse_parse_type(const char *str, enum rte_argparse_value_type val_type, void *val);
236
237#ifdef __cplusplus
238}
239#endif
240
241#endif /* RTE_ARGPARSE_H */
__rte_experimental void rte_argparse_print_help(FILE *stream, const struct rte_argparse *obj)
rte_argparse_value_required
@ RTE_ARGPARSE_VALUE_OPTIONAL
@ RTE_ARGPARSE_VALUE_NONE
@ RTE_ARGPARSE_VALUE_REQUIRED
__rte_experimental int rte_argparse_parse(const struct rte_argparse *obj, int argc, char **argv)
rte_argparse_arg_flags
@ RTE_ARGPARSE_FLAG_SUPPORT_MULTI
__rte_experimental int rte_argparse_parse_type(const char *str, enum rte_argparse_value_type val_type, void *val)
int(* rte_arg_parser_t)(uint32_t index, const char *value, void *opaque)
rte_argparse_value_type
@ RTE_ARGPARSE_VALUE_TYPE_U16
@ RTE_ARGPARSE_VALUE_TYPE_CORELIST
@ RTE_ARGPARSE_VALUE_TYPE_STR
@ RTE_ARGPARSE_VALUE_TYPE_U64
@ RTE_ARGPARSE_VALUE_TYPE_INT
@ RTE_ARGPARSE_VALUE_TYPE_U32
@ RTE_ARGPARSE_VALUE_TYPE_U8
@ RTE_ARGPARSE_VALUE_TYPE_BOOL
@ RTE_ARGPARSE_VALUE_TYPE_NONE
#define RTE_BIT32(nr)
Definition rte_bitops.h:44
enum rte_argparse_value_type value_type
enum rte_argparse_value_required value_required
const char * name_long
const char * help
const char * name_short
const char * epilog
rte_arg_parser_t callback
const char * prog_name
void(* print_help)(const struct rte_argparse *obj)
const char * descriptor
struct rte_argparse_arg args[]
void * reserved[15]
bool ignore_non_flag_args
const char * usage