logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Author

       Generated automatically by Doxygen for DPDK from the source code.

DPDK                                             Version 24.11.2                                rte_cfgfile.h(3)

Detailed Description

       Configuration File management.

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

       Definition in file rte_cfgfile.h.

Enumeration Type Documentation

anonymousenum
       cfgfile load operation flags

       EnumeratorCFG_FLAG_GLOBAL_SECTION
              Indicates that the file supports key value entries before the first defined section. These entries
              can be accessed in the 'GLOBAL' section.

       CFG_FLAG_EMPTY_VALUES
              Indicates that file supports key value entries where the value can be zero length (e.g., 'key=').

       Definition at line 46 of file rte_cfgfile.h.

Function Documentation

structrte_cfgfile*rte_cfgfile_load(constchar*filename,intflags)
       Open config file.

       Parametersfilename Config file name.
           flags Config file flags.

       Returns
           Handle to configuration file on success, NULL otherwise.

   structrte_cfgfile*rte_cfgfile_load_with_params(constchar*filename,intflags,conststructrte_cfgfile_parameters*params)
       Open config file with specified optional parameters.

       Parametersfilename Config file name
           flags Config file flags
           params Additional configuration attributes. Must be configured with desired values prior to  invoking
           this API.

       Returns
           Handle to configuration file on success, NULL otherwise

   structrte_cfgfile*rte_cfgfile_create(intflags)
       Create new cfgfile instance with empty sections and entries

       Parametersflags

           • CFG_FLAG_GLOBAL_SECTION Indicates that the file supports key value entries before the first defined
             section. These entries can be accessed in the 'GLOBAL' section.

           • CFG_FLAG_EMPTY_VALUES  Indicates  that  file supports key value entries where the value can be zero
             length (e.g., 'key=').

       Returns
           Handle to cfgfile instance on success, NULL otherwise

   intrte_cfgfile_add_section(structrte_cfgfile*cfg,constchar*sectionname)
       Add section in cfgfile instance.

       Parameterscfg Pointer to the cfgfile structure.
           sectionname Section name which will be add to cfgfile.

       Returns
           0 on success, -ENOMEM if can't add section

   intrte_cfgfile_add_entry(structrte_cfgfile*cfg,constchar*sectionname,constchar*entryname,constchar*entryvalue)
       Add entry to specified section in cfgfile instance.

       Parameterscfg Pointer to the cfgfile structure.
           sectionname Given section name to add an entry.
           entryname Entry name to add.
           entryvalue Entry value to add.

       Returns
           0 on success, -EEXIST if entry already exist, -EINVAL if bad argument

   intrte_cfgfile_set_entry(structrte_cfgfile*cfg,constchar*sectionname,constchar*entryname,constchar*entryvalue)
       Update value of specified entry name in given section in config file

       Parameterscfg Config file
           sectionname Section name
           entryname Entry name to look for the value change
           entryvalue New entry value. Can be also an empty string if CFG_FLAG_EMPTY_VALUES = 1

       Returns
           0 on success, -EINVAL if bad argument

   intrte_cfgfile_save(structrte_cfgfile*cfg,constchar*filename)
       Save object cfgfile to file on disc

       Parameterscfg Config file structure
           filename File name to save data

       Returns
           0 on success, errno otherwise

   intrte_cfgfile_num_sections(structrte_cfgfile*cfg,constchar*sec_name,size_tlength)
       Get number of sections in config file.

       Parameterscfg Config file.
           sec_name Section name.
           length Maximum section name length.

       Returns
           Number of sections.

   intrte_cfgfile_sections(structrte_cfgfile*cfg,char*sections[],intmax_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).

       Parameterscfg Config file.
           sections  Array  containing  section  names  after  successful invocation. Each element of this array
           should be preallocated by the user with at least CFG_NAME_LEN characters.
           max_sections Maximum number of section names to be stored in sections array.

       Returns
           Number of populated sections names.

   intrte_cfgfile_has_section(structrte_cfgfile*cfg,constchar*sectionname)
       Check if given section exists in config file.

       Parameterscfg Config file.
           sectionname Section name.

       Returns
           TRUE (value different than 0) if section exists, FALSE (value 0) otherwise.

   intrte_cfgfile_section_num_entries(structrte_cfgfile*cfg,constchar*sectionname)
       Get number of entries in given config file section.

       If multiple sections have the given name, this function operates on the first one.

       Parameterscfg Config file.
           sectionname Section name.

       Returns
           Number of entries in section on success, -1 otherwise.

   intrte_cfgfile_section_num_entries_by_index(structrte_cfgfile*cfg,char*sectionname,intindex)
       Get number of entries in given config file section.

       The index of a section is the same as the index of its name in the result of  rte_cfgfile_sections.  This
       API can be used when there are multiple sections with the same name.

       Parameterscfg Config file.
           sectionname Section name.
           index Section index.

       Returns
           Number of entries in section on success, -1 otherwise.

   intrte_cfgfile_section_entries(structrte_cfgfile*cfg,constchar*sectionname,structrte_cfgfile_entry*entries,intmax_entries)
       Get section entries as key-value pairs.

       If multiple sections have the given name, this function operates on the first one.

       Parameterscfg Config file.
           sectionname Section name.
           entries  Pre-allocated  array of at least max_entries entries where the section entries are stored as
           key-value pair after successful invocation.
           max_entries Maximum number of section entries to be stored in entries array.

       Returns
           Number of entries populated on success, -1 otherwise.

   intrte_cfgfile_section_entries_by_index(structrte_cfgfile*cfg,intindex,char*sectionname,structrte_cfgfile_entry*entries,intmax_entries)
       Get section entries as key-value pairs.

       The  index  of a section is the same as the index of its name in the result of rte_cfgfile_sections. This
       API can be used when there are multiple sections with the same name.

       Parameterscfg Config file.
           index Section index.
           sectionname Pre-allocated string of at least CFG_NAME_LEN characters where the section name is stored
           after successful invocation.
           entries Pre-allocated array of at least max_entries entries where the section entries are  stored  as
           key-value pair after successful invocation.
           max_entries Maximum number of section entries to be stored in entries array.

       Returns
           Number of entries populated on success, -1 otherwise.

   constchar*rte_cfgfile_get_entry(structrte_cfgfile*cfg,constchar*sectionname,constchar*entryname)
       Get value of the named entry in named config file section.

       If multiple sections have the given name, this function operates on the first one.

       Parameterscfg Config file.
           sectionname Section name.
           entryname Entry name.

       Returns
           Entry value on success, NULL otherwise.

   intrte_cfgfile_has_entry(structrte_cfgfile*cfg,constchar*sectionname,constchar*entryname)
       Check if given entry exists in named config file section.

       If multiple sections have the given name, this function operates on the first one.

       Parameterscfg Config file.
           sectionname Section name.
           entryname Entry name.

       Returns
           TRUE (value different than 0) if entry exists, FALSE (value 0) otherwise.

   intrte_cfgfile_close(structrte_cfgfile*cfg)
       Close config file.

       Parameterscfg Config file.

       Returns
           0 on success, -1 otherwise.

Macro Definition Documentation

#defineCFG_DEFAULT_COMMENT_CHARACTER';'
       Defines the default comment character used for parsing config files.

       Definition at line 63 of file rte_cfgfile.h.

Name

       rte_cfgfile.h

Synopsis

       #include <stddef.h>

   DataStructures
       struct rte_cfgfile_entry
       struct rte_cfgfile_parametersMacros
       #define CFG_DEFAULT_COMMENT_CHARACTER   ';'

   Functions
       struct rte_cfgfile * rte_cfgfile_load (const char *filename, int flags)
       struct rte_cfgfile * rte_cfgfile_load_with_params (const char *filename, int flags, const struct
           rte_cfgfile_parameters *params)
       struct rte_cfgfile * rte_cfgfile_create (int flags)
       int rte_cfgfile_add_section (struct rte_cfgfile *cfg, const char *sectionname)
       int rte_cfgfile_add_entry (struct rte_cfgfile *cfg, const char *sectionname, const char *entryname, const
           char *entryvalue)
       int rte_cfgfile_set_entry (struct rte_cfgfile *cfg, const char *sectionname, const char *entryname, const
           char *entryvalue)
       int rte_cfgfile_save (struct rte_cfgfile *cfg, const char *filename)
       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_num_entries_by_index (struct rte_cfgfile *cfg, char *sectionname, int index)
       int rte_cfgfile_section_entries (struct rte_cfgfile *cfg, const char *sectionname, struct
           rte_cfgfile_entry *entries, int max_entries)
       int rte_cfgfile_section_entries_by_index (struct rte_cfgfile *cfg, int index, 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)

See Also