DPDK 25.11.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
29
30#include <stdbool.h>
31#include <stdint.h>
32
33#include <rte_bitops.h>
34#include <rte_compat.h>
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
51
75
81
92 const char *name_long;
99 const char *name_short;
100
102 const char *help;
103
120 void *val_set;
121
126
128 uint32_t flags;
129};
130
145typedef int (*rte_arg_parser_t)(uint32_t index, const char *value, void *opaque);
146
152 const char *prog_name;
154 const char *usage;
156 const char *descriptor;
158 const char *epilog;
165 /* reserved for future flags/other use */
166 bool reserved_flags[6];
170 void *opaque;
175 void (*print_help)(const struct rte_argparse *obj);
177 void *reserved[15];
180};
181
182#define ARGPARSE_ARG_END() { NULL }
183
202__rte_experimental
203int rte_argparse_parse(const struct rte_argparse *obj, int argc, char **argv);
204
216__rte_experimental
217void rte_argparse_print_help(FILE *stream, const struct rte_argparse *obj);
218
235__rte_experimental
236int rte_argparse_parse_type(const char *str, enum rte_argparse_value_type val_type, void *val);
237
238#ifdef __cplusplus
239}
240#endif
241
242#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