DPDK  22.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 
40 typedef int (*arg_handler_t)(const char *key, const char *value, void *opaque);
41 
44  char *key;
45  char *value;
46 };
47 
49 struct rte_kvargs {
50  char *str;
51  unsigned count;
53 };
54 
73 struct rte_kvargs *rte_kvargs_parse(const char *args,
74  const char *const valid_keys[]);
75 
101 struct rte_kvargs *rte_kvargs_parse_delim(const char *args,
102  const char *const valid_keys[],
103  const char *valid_ends);
104 
114 void rte_kvargs_free(struct rte_kvargs *kvlist);
115 
133 const char *rte_kvargs_get(const struct rte_kvargs *kvlist, const char *key);
134 
158 __rte_experimental
159 const char *rte_kvargs_get_with_value(const struct rte_kvargs *kvlist,
160  const char *key, const char *value);
161 
183 int rte_kvargs_process(const struct rte_kvargs *kvlist,
184  const char *key_match, arg_handler_t handler, void *opaque_arg);
185 
197 unsigned rte_kvargs_count(const struct rte_kvargs *kvlist,
198  const char *key_match);
199 
200 #ifdef __cplusplus
201 }
202 #endif
203 
204 #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:51
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:40
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:50
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)