DPDK  2.2.0
Data Structures | Functions
rte_cfgfile.h File Reference

Go to the source code of this file.

Data Structures

struct  rte_cfgfile_entry

Functions

struct rte_cfgfile * rte_cfgfile_load (const char *filename, int flags)
int rte_cfgfile_num_sections (struct rte_cfgfile *cfg, const char *sec_name, size_t length)
int rte_cfgfile_sections (struct rte_cfgfile *cfg, char *sections[], int max_sections)
int rte_cfgfile_has_section (struct rte_cfgfile *cfg, const char *sectionname)
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)
const char * rte_cfgfile_get_entry (struct rte_cfgfile *cfg, const char *sectionname, const char *entryname)
int rte_cfgfile_has_entry (struct rte_cfgfile *cfg, const char *sectionname, const char *entryname)
int rte_cfgfile_close (struct rte_cfgfile *cfg)

Detailed Description

RTE Configuration File

This library allows reading application defined parameters from standard format configuration file.

Definition in file rte_cfgfile.h.

Function Documentation

struct rte_cfgfile* rte_cfgfile_load ( const char *  filename,
int  flags 
)
read

Open config file

Parameters
filenameConfig file name
flagsConfig file flags, Reserved for future use. Must be set to 0.
Returns
Handle to configuration file
Examples:
ip_pipeline/config_parse.c, ip_pipeline/config_parse_tm.c, and qos_sched/init.c.
int rte_cfgfile_num_sections ( struct rte_cfgfile *  cfg,
const char *  sec_name,
size_t  length 
)

Get number of sections in config file

Parameters
cfgConfig file
sec_nameSection name
lengthMaximum section name length
Returns
0 on success, error code otherwise
Examples:
ip_pipeline/config_parse.c, ip_pipeline/config_parse_tm.c, and qos_sched/cfg_file.c.
int rte_cfgfile_sections ( struct rte_cfgfile *  cfg,
char *  sections[],
int  max_sections 
)

Get name of all config file sections.

Fills in the array sections with the name of all the sections in the file (up to the number of max_sections sections).

Parameters
cfgConfig file
sectionsArray containing section names after successful invocation. Each elemen of this array should be preallocated by the user with at least CFG_NAME_LEN characters.
max_sectionsMaximum number of section names to be stored in sections array
Returns
0 on success, error code otherwise
Examples:
ip_pipeline/config_parse.c.
int rte_cfgfile_has_section ( struct rte_cfgfile *  cfg,
const char *  sectionname 
)

Check if given section exists in config file

Parameters
cfgConfig file
sectionnameSection name
Returns
TRUE (value different than 0) if section exists, FALSE (value 0) otherwise
Examples:
ip_pipeline/config_parse_tm.c, and qos_sched/cfg_file.c.
int rte_cfgfile_section_num_entries ( struct rte_cfgfile *  cfg,
const char *  sectionname 
)

Get number of entries in given config file section

Parameters
cfgConfig file
sectionnameSection name
Returns
Number of entries in section
Examples:
ip_pipeline/config_parse.c, ip_pipeline/config_parse_tm.c, and qos_sched/cfg_file.c.
int rte_cfgfile_section_entries ( struct rte_cfgfile *  cfg,
const char *  sectionname,
struct rte_cfgfile_entry entries,
int  max_entries 
)

Get section entries as key-value pairs

Parameters
cfgConfig file
sectionnameSection name
entriesPre-allocated array of at least max_entries entries where the section entries are stored as key-value pair after successful invocation
max_entriesMaximum number of section entries to be stored in entries array
Returns
0 on success, error code otherwise
Examples:
ip_pipeline/config_parse.c, ip_pipeline/config_parse_tm.c, and qos_sched/cfg_file.c.
const char* rte_cfgfile_get_entry ( struct rte_cfgfile *  cfg,
const char *  sectionname,
const char *  entryname 
)

Get value of the named entry in named config file section

Parameters
cfgConfig file
sectionnameSection name
entrynameEntry name
Returns
Entry value
Examples:
ip_pipeline/config_parse_tm.c, and qos_sched/cfg_file.c.
int rte_cfgfile_has_entry ( struct rte_cfgfile *  cfg,
const char *  sectionname,
const char *  entryname 
)

Check if given entry exists in named config file section

Parameters
cfgConfig file
sectionnameSection name
entrynameEntry name
Returns
TRUE (value different than 0) if entry exists, FALSE (value 0) otherwise
int rte_cfgfile_close ( struct rte_cfgfile *  cfg)

Close config file

Parameters
cfgConfig file
Returns
0 on success, error code otherwise
Examples:
ip_pipeline/config_parse.c, ip_pipeline/config_parse_tm.c, and qos_sched/init.c.