DPDK  24.11.0-rc3
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 
22 #ifndef CFG_NAME_LEN
23 #define CFG_NAME_LEN 64
24 #endif
25 
26 #ifndef CFG_VALUE_LEN
27 #define CFG_VALUE_LEN 256
28 #endif
29 
31 struct rte_cfgfile;
32 
35  char name[CFG_NAME_LEN];
36  char value[CFG_VALUE_LEN];
37 };
38 
43 };
44 
46 enum {
53 
59 };
63 #define CFG_DEFAULT_COMMENT_CHARACTER ';'
64 
75 struct rte_cfgfile *rte_cfgfile_load(const char *filename, int flags);
76 
90 struct rte_cfgfile *rte_cfgfile_load_with_params(const char *filename,
91  int flags, const struct rte_cfgfile_parameters *params);
92 
107 struct rte_cfgfile *rte_cfgfile_create(int flags);
108 
119 int
120 rte_cfgfile_add_section(struct rte_cfgfile *cfg, const char *sectionname);
121 
136 int rte_cfgfile_add_entry(struct rte_cfgfile *cfg,
137  const char *sectionname, const char *entryname,
138  const char *entryvalue);
139 
154 int rte_cfgfile_set_entry(struct rte_cfgfile *cfg, const char *sectionname,
155  const char *entryname, const char *entryvalue);
156 
167 int rte_cfgfile_save(struct rte_cfgfile *cfg, const char *filename);
168 
181 int rte_cfgfile_num_sections(struct rte_cfgfile *cfg, const char *sec_name,
182  size_t length);
183 
201 int rte_cfgfile_sections(struct rte_cfgfile *cfg, char *sections[],
202  int max_sections);
203 
214 int rte_cfgfile_has_section(struct rte_cfgfile *cfg, const char *sectionname);
215 
229 int rte_cfgfile_section_num_entries(struct rte_cfgfile *cfg,
230  const char *sectionname);
231 
248 int rte_cfgfile_section_num_entries_by_index(struct rte_cfgfile *cfg,
249  char *sectionname,
250  int index);
251 
270 int rte_cfgfile_section_entries(struct rte_cfgfile *cfg,
271  const char *sectionname,
272  struct rte_cfgfile_entry *entries,
273  int max_entries);
274 
297 int rte_cfgfile_section_entries_by_index(struct rte_cfgfile *cfg,
298  int index,
299  char *sectionname,
300  struct rte_cfgfile_entry *entries,
301  int max_entries);
302 
318 const char *rte_cfgfile_get_entry(struct rte_cfgfile *cfg,
319  const char *sectionname,
320  const char *entryname);
321 
337 int rte_cfgfile_has_entry(struct rte_cfgfile *cfg, const char *sectionname,
338  const char *entryname);
339 
348 int rte_cfgfile_close(struct rte_cfgfile *cfg);
349 
350 #ifdef __cplusplus
351 }
352 #endif
353 
354 #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:35
char value[CFG_VALUE_LEN]
Definition: rte_cfgfile.h:36
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:34
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)