DPDK  26.03.0
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 
140 int rte_cfgfile_add_entry(struct rte_cfgfile *cfg,
141  const char *sectionname, const char *entryname,
142  const char *entryvalue);
143 
158 int rte_cfgfile_set_entry(struct rte_cfgfile *cfg, const char *sectionname,
159  const char *entryname, const char *entryvalue);
160 
171 int rte_cfgfile_save(struct rte_cfgfile *cfg, const char *filename);
172 
185 int rte_cfgfile_num_sections(struct rte_cfgfile *cfg, const char *sec_name,
186  size_t length);
187 
205 int rte_cfgfile_sections(struct rte_cfgfile *cfg, char *sections[],
206  int max_sections);
207 
218 int rte_cfgfile_has_section(struct rte_cfgfile *cfg, const char *sectionname);
219 
233 int rte_cfgfile_section_num_entries(struct rte_cfgfile *cfg,
234  const char *sectionname);
235 
252 int rte_cfgfile_section_num_entries_by_index(struct rte_cfgfile *cfg,
253  char *sectionname,
254  int index);
255 
274 int rte_cfgfile_section_entries(struct rte_cfgfile *cfg,
275  const char *sectionname,
276  struct rte_cfgfile_entry *entries,
277  int max_entries);
278 
301 int rte_cfgfile_section_entries_by_index(struct rte_cfgfile *cfg,
302  int index,
303  char *sectionname,
304  struct rte_cfgfile_entry *entries,
305  int max_entries);
306 
322 const char *rte_cfgfile_get_entry(struct rte_cfgfile *cfg,
323  const char *sectionname,
324  const char *entryname);
325 
341 int rte_cfgfile_has_entry(struct rte_cfgfile *cfg, const char *sectionname,
342  const char *entryname);
343 
352 int rte_cfgfile_close(struct rte_cfgfile *cfg);
353 
354 #ifdef __cplusplus
355 }
356 #endif
357 
358 #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)