DPDK  20.11.10
rte_cfgfile.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2014 Intel Corporation
3  */
4 
5 #ifndef __INCLUDE_RTE_CFGFILE_H__
6 #define __INCLUDE_RTE_CFGFILE_H__
7 
8 #include <stddef.h>
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
23 #ifndef CFG_NAME_LEN
24 #define CFG_NAME_LEN 64
25 #endif
26 
27 #ifndef CFG_VALUE_LEN
28 #define CFG_VALUE_LEN 256
29 #endif
30 
32 struct rte_cfgfile;
33 
36  char name[CFG_NAME_LEN];
37  char value[CFG_VALUE_LEN];
38 };
39 
44 };
45 
47 enum {
54 
60 };
64 #define CFG_DEFAULT_COMMENT_CHARACTER ';'
65 
76 struct rte_cfgfile *rte_cfgfile_load(const char *filename, int flags);
77 
91 struct rte_cfgfile *rte_cfgfile_load_with_params(const char *filename,
92  int flags, const struct rte_cfgfile_parameters *params);
93 
108 struct rte_cfgfile *rte_cfgfile_create(int flags);
109 
120 int
121 rte_cfgfile_add_section(struct rte_cfgfile *cfg, const char *sectionname);
122 
137 int rte_cfgfile_add_entry(struct rte_cfgfile *cfg,
138  const char *sectionname, const char *entryname,
139  const char *entryvalue);
140 
155 int rte_cfgfile_set_entry(struct rte_cfgfile *cfg, const char *sectionname,
156  const char *entryname, const char *entryvalue);
157 
168 int rte_cfgfile_save(struct rte_cfgfile *cfg, const char *filename);
169 
182 int rte_cfgfile_num_sections(struct rte_cfgfile *cfg, const char *sec_name,
183  size_t length);
184 
202 int rte_cfgfile_sections(struct rte_cfgfile *cfg, char *sections[],
203  int max_sections);
204 
215 int rte_cfgfile_has_section(struct rte_cfgfile *cfg, const char *sectionname);
216 
230 int rte_cfgfile_section_num_entries(struct rte_cfgfile *cfg,
231  const char *sectionname);
232 
249 int rte_cfgfile_section_num_entries_by_index(struct rte_cfgfile *cfg,
250  char *sectionname,
251  int index);
252 
271 int rte_cfgfile_section_entries(struct rte_cfgfile *cfg,
272  const char *sectionname,
273  struct rte_cfgfile_entry *entries,
274  int max_entries);
275 
298 int rte_cfgfile_section_entries_by_index(struct rte_cfgfile *cfg,
299  int index,
300  char *sectionname,
301  struct rte_cfgfile_entry *entries,
302  int max_entries);
303 
319 const char *rte_cfgfile_get_entry(struct rte_cfgfile *cfg,
320  const char *sectionname,
321  const char *entryname);
322 
338 int rte_cfgfile_has_entry(struct rte_cfgfile *cfg, const char *sectionname,
339  const char *entryname);
340 
349 int rte_cfgfile_close(struct rte_cfgfile *cfg);
350 
351 #ifdef __cplusplus
352 }
353 #endif
354 
355 #endif
int rte_cfgfile_add_entry(struct rte_cfgfile *cfg, const char *sectionname, const char *entryname, const char *entryvalue)
int rte_cfgfile_has_entry(struct rte_cfgfile *cfg, const char *sectionname, const char *entryname)
int rte_cfgfile_section_num_entries(struct rte_cfgfile *cfg, const char *sectionname)
int rte_cfgfile_section_entries(struct rte_cfgfile *cfg, const char *sectionname, struct rte_cfgfile_entry *entries, int max_entries)
struct rte_cfgfile * rte_cfgfile_create(int flags)
char name[CFG_NAME_LEN]
Definition: rte_cfgfile.h:36
char value[CFG_VALUE_LEN]
Definition: rte_cfgfile.h:37
int rte_cfgfile_add_section(struct rte_cfgfile *cfg, const char *sectionname)
int rte_cfgfile_num_sections(struct rte_cfgfile *cfg, const char *sec_name, size_t length)
int rte_cfgfile_save(struct rte_cfgfile *cfg, const char *filename)
int rte_cfgfile_has_section(struct rte_cfgfile *cfg, const char *sectionname)
Definition: rte_cfgfile.h:35
int rte_cfgfile_sections(struct rte_cfgfile *cfg, char *sections[], int max_sections)
int rte_cfgfile_section_num_entries_by_index(struct rte_cfgfile *cfg, char *sectionname, int index)
int rte_cfgfile_section_entries_by_index(struct rte_cfgfile *cfg, int index, char *sectionname, struct rte_cfgfile_entry *entries, int max_entries)
struct rte_cfgfile * rte_cfgfile_load(const char *filename, int flags)
int rte_cfgfile_set_entry(struct rte_cfgfile *cfg, const char *sectionname, const char *entryname, const char *entryvalue)
int rte_cfgfile_close(struct rte_cfgfile *cfg)
struct rte_cfgfile * rte_cfgfile_load_with_params(const char *filename, int flags, const struct rte_cfgfile_parameters *params)
const char * rte_cfgfile_get_entry(struct rte_cfgfile *cfg, const char *sectionname, const char *entryname)