DPDK 25.07.0
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
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
50};
51
72};
73
78};
79
90 const char *name_long;
97 const char *name_short;
98
100 const char *help;
101
118 void *val_set;
119
124
126 uint32_t flags;
127};
128
143typedef int (*rte_arg_parser_t)(uint32_t index, const char *value, void *opaque);
144
150 const char *prog_name;
152 const char *usage;
154 const char *descriptor;
156 const char *epilog;
162 void *opaque;
164 void *reserved[16];
167};
168
169#define ARGPARSE_ARG_END() { NULL }
170
189__rte_experimental
190int rte_argparse_parse(const struct rte_argparse *obj, int argc, char **argv);
191
208__rte_experimental
209int rte_argparse_parse_type(const char *str, enum rte_argparse_value_type val_type, void *val);
210
211#ifdef __cplusplus
212}
213#endif
214
215#endif /* RTE_ARGPARSE_H */
rte_argparse_value_required
Definition: rte_argparse.h:43
@ RTE_ARGPARSE_VALUE_OPTIONAL
Definition: rte_argparse.h:49
@ RTE_ARGPARSE_VALUE_NONE
Definition: rte_argparse.h:45
@ RTE_ARGPARSE_VALUE_REQUIRED
Definition: rte_argparse.h:47
__rte_experimental int rte_argparse_parse(const struct rte_argparse *obj, int argc, char **argv)
rte_argparse_arg_flags
Definition: rte_argparse.h:75
@ RTE_ARGPARSE_FLAG_SUPPORT_MULTI
Definition: rte_argparse.h:77
__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)
Definition: rte_argparse.h:143
rte_argparse_value_type
Definition: rte_argparse.h:53
@ RTE_ARGPARSE_VALUE_TYPE_U16
Definition: rte_argparse.h:63
@ RTE_ARGPARSE_VALUE_TYPE_STR
Definition: rte_argparse.h:69
@ RTE_ARGPARSE_VALUE_TYPE_U64
Definition: rte_argparse.h:67
@ RTE_ARGPARSE_VALUE_TYPE_INT
Definition: rte_argparse.h:59
@ RTE_ARGPARSE_VALUE_TYPE_U32
Definition: rte_argparse.h:65
@ RTE_ARGPARSE_VALUE_TYPE_U8
Definition: rte_argparse.h:61
@ RTE_ARGPARSE_VALUE_TYPE_BOOL
Definition: rte_argparse.h:71
@ RTE_ARGPARSE_VALUE_TYPE_NONE
Definition: rte_argparse.h:57
#define RTE_BIT32(nr)
Definition: rte_bitops.h:44
enum rte_argparse_value_type value_type
Definition: rte_argparse.h:123
enum rte_argparse_value_required value_required
Definition: rte_argparse.h:121
const char * name_long
Definition: rte_argparse.h:90
const char * help
Definition: rte_argparse.h:100
const char * name_short
Definition: rte_argparse.h:97
const char * epilog
Definition: rte_argparse.h:156
void * reserved[16]
Definition: rte_argparse.h:164
rte_arg_parser_t callback
Definition: rte_argparse.h:160
const char * prog_name
Definition: rte_argparse.h:150
const char * descriptor
Definition: rte_argparse.h:154
struct rte_argparse_arg args[]
Definition: rte_argparse.h:166
const char * usage
Definition: rte_argparse.h:152
bool exit_on_error
Definition: rte_argparse.h:158