DPDK  23.07.0
rte_kvargs.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2013 Intel Corporation.
3  * Copyright(c) 2014 6WIND S.A.
4  */
5 
6 #ifndef _RTE_KVARGS_H_
7 #define _RTE_KVARGS_H_
8 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 #include <rte_compat.h>
29 
31 #define RTE_KVARGS_MAX 32
32 
34 #define RTE_KVARGS_PAIRS_DELIM ","
35 
37 #define RTE_KVARGS_KV_DELIM "="
38 
52 typedef int (*arg_handler_t)(const char *key, const char *value, void *opaque);
53 
56  char *key;
57  char *value;
58 };
59 
61 struct rte_kvargs {
62  char *str;
63  unsigned count;
65 };
66 
85 struct rte_kvargs *rte_kvargs_parse(const char *args,
86  const char *const valid_keys[]);
87 
113 struct rte_kvargs *rte_kvargs_parse_delim(const char *args,
114  const char *const valid_keys[],
115  const char *valid_ends);
116 
126 void rte_kvargs_free(struct rte_kvargs *kvlist);
127 
145 const char *rte_kvargs_get(const struct rte_kvargs *kvlist, const char *key);
146 
170 __rte_experimental
171 const char *rte_kvargs_get_with_value(const struct rte_kvargs *kvlist,
172  const char *key, const char *value);
173 
195 int rte_kvargs_process(const struct rte_kvargs *kvlist,
196  const char *key_match, arg_handler_t handler, void *opaque_arg);
197 
209 unsigned rte_kvargs_count(const struct rte_kvargs *kvlist,
210  const char *key_match);
211 
212 #ifdef __cplusplus
213 }
214 #endif
215 
216 #endif
#define RTE_KVARGS_MAX
Definition: rte_kvargs.h:31
struct rte_kvargs * rte_kvargs_parse_delim(const char *args, const char *const valid_keys[], const char *valid_ends)
void *(* handler)(void *sock_id)
unsigned count
Definition: rte_kvargs.h:63
void rte_kvargs_free(struct rte_kvargs *kvlist)
unsigned rte_kvargs_count(const struct rte_kvargs *kvlist, const char *key_match)
int(* arg_handler_t)(const char *key, const char *value, void *opaque)
Definition: rte_kvargs.h:52
const char * rte_kvargs_get(const struct rte_kvargs *kvlist, const char *key)
__rte_experimental const char * rte_kvargs_get_with_value(const struct rte_kvargs *kvlist, const char *key, const char *value)
char * str
Definition: rte_kvargs.h:62
struct rte_kvargs * rte_kvargs_parse(const char *args, const char *const valid_keys[])
int rte_kvargs_process(const struct rte_kvargs *kvlist, const char *key_match, arg_handler_t handler, void *opaque_arg)