DPDK  20.08.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 __rte_experimental
102 struct rte_kvargs *rte_kvargs_parse_delim(const char *args,
103  const char *const valid_keys[],
104  const char *valid_ends);
105 
115 void rte_kvargs_free(struct rte_kvargs *kvlist);
116 
138 int rte_kvargs_process(const struct rte_kvargs *kvlist,
139  const char *key_match, arg_handler_t handler, void *opaque_arg);
140 
152 unsigned rte_kvargs_count(const struct rte_kvargs *kvlist,
153  const char *key_match);
154 
178 __rte_experimental
179 int rte_kvargs_strcmp(const char *key, const char *value, void *opaque);
180 
181 #ifdef __cplusplus
182 }
183 #endif
184 
185 #endif
#define RTE_KVARGS_MAX
Definition: rte_kvargs.h:31
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)
__rte_experimental struct rte_kvargs * rte_kvargs_parse_delim(const char *args, const char *const valid_keys[], const char *valid_ends)
int(* arg_handler_t)(const char *key, const char *value, void *opaque)
Definition: rte_kvargs.h:40
struct rte_kvargs_pair pairs[RTE_KVARGS_MAX]
Definition: rte_kvargs.h:52
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)
__rte_experimental int rte_kvargs_strcmp(const char *key, const char *value, void *opaque)