DPDK  16.11.11
rte_cfgfile.h
Go to the documentation of this file.
1 /*-
2  * BSD LICENSE
3  *
4  * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above copyright
14  * notice, this list of conditions and the following disclaimer in
15  * the documentation and/or other materials provided with the
16  * distribution.
17  * * Neither the name of Intel Corporation nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 #ifndef __INCLUDE_RTE_CFGFILE_H__
35 #define __INCLUDE_RTE_CFGFILE_H__
36 
37 #include <stddef.h>
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
52 #ifndef CFG_NAME_LEN
53 #define CFG_NAME_LEN 64
54 #endif
55 
56 #ifndef CFG_VALUE_LEN
57 #define CFG_VALUE_LEN 256
58 #endif
59 
61 struct rte_cfgfile;
62 
65  char name[CFG_NAME_LEN];
66  char value[CFG_VALUE_LEN];
67 };
68 
79 struct rte_cfgfile *rte_cfgfile_load(const char *filename, int flags);
80 
93 int rte_cfgfile_num_sections(struct rte_cfgfile *cfg, const char *sec_name,
94  size_t length);
95 
113 int rte_cfgfile_sections(struct rte_cfgfile *cfg, char *sections[],
114  int max_sections);
115 
126 int rte_cfgfile_has_section(struct rte_cfgfile *cfg, const char *sectionname);
127 
141 int rte_cfgfile_section_num_entries(struct rte_cfgfile *cfg,
142  const char *sectionname);
143 
162 int rte_cfgfile_section_entries(struct rte_cfgfile *cfg,
163  const char *sectionname,
164  struct rte_cfgfile_entry *entries,
165  int max_entries);
166 
189 int rte_cfgfile_section_entries_by_index(struct rte_cfgfile *cfg,
190  int index,
191  char *sectionname,
192  struct rte_cfgfile_entry *entries,
193  int max_entries);
194 
210 const char *rte_cfgfile_get_entry(struct rte_cfgfile *cfg,
211  const char *sectionname,
212  const char *entryname);
213 
229 int rte_cfgfile_has_entry(struct rte_cfgfile *cfg, const char *sectionname,
230  const char *entryname);
231 
240 int rte_cfgfile_close(struct rte_cfgfile *cfg);
241 
242 #ifdef __cplusplus
243 }
244 #endif
245 
246 #endif
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)
char name[CFG_NAME_LEN]
Definition: rte_cfgfile.h:65
char value[CFG_VALUE_LEN]
Definition: rte_cfgfile.h:66
int rte_cfgfile_num_sections(struct rte_cfgfile *cfg, const char *sec_name, size_t length)
int rte_cfgfile_has_section(struct rte_cfgfile *cfg, const char *sectionname)
Definition: rte_cfgfile.h:64
int rte_cfgfile_sections(struct rte_cfgfile *cfg, char *sections[], int max_sections)
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_close(struct rte_cfgfile *cfg)
const char * rte_cfgfile_get_entry(struct rte_cfgfile *cfg, const char *sectionname, const char *entryname)