libcfg is the heart of the cfgd-project. It provides an API to create and manipulate configurations.

You can find the API-documentation here

The config is actually stored in an xml-file. Note however, that the normal user of this lib should not see these files as they are handled by cfgd. He just needs to know which fields are availible. So here is a description:


<?xml version="1.0" ?>
<config version="1.0">
<var>
        <name> Name </name>
        <value> Value </value>
        <description> Desc </description>
        <comment> Comment </comment>
        <status> 123 </status>
        <predef>
                <value> val1 </value>             
                <value> val2 </value>            
        </predef>
</var>
<section>
        <name> Name </name>
        <description> Desc </description
        <comment> Comment </comment>
        <status> 123 </status>
        <var>
                ...
        </var>
        <section>
                ...
        </section>
</section>
</config>

Now we have a deeper look at the field of a config.
<var>
Starts a variable definition. A config can have an abitrary number of variables.
        <name> Name </name>
Sets the name of this variable to 'Name'.
        <value> Value </value>
Sets the value of this variable to 'Value'.
        <description> Desc </description>
This field gives the application-author a chance to describe what this variable is meant to be, ie. the purpose of this variable.
        <status> 123 </status>
Defines the status of this variable. I.e. is it active or deactivated, local to a given host etc. This field is a numeric bitfield. The bits are defined in libcfg.
        <comment> Comment </comment>
The application user can e.g. disable a variable. This field is reserverd for him to document why he did this.
        <predef>
Starts a predefinition field for this variable. The variable value can only be one of those values.
                <value> val1 </value>             
All possible values within a <value> tag.
                <value> val2 </value>            
        </predef>
</var>
end of a variable definition.
<section>
Starts a section definition.
        <name> Name </name>
The name of this section.
        <description> Desc </description
A description of this section (same meaning as for variables).
        <comment> Comment </comment>
A comment.
        <status> Status </status>
A status.
        <var>
                ...
        </var>
A section can contain an arbitrary number of variables.
        <section>
                ...
        </section>
And an arbitrary number of subsections.
</section>
End of a section definition.
You can see a more complex example with an example application here