conf

conf -

Author(s):

Synopsis

typedef virConfValue * virConfValuePtr;
typedef enum virConfType;
typedef struct _virConfValue virConfValue;
typedef struct _virConf virConf;
typedef virConf * virConfPtr;
int	virConfWriteFile		(const char * filename, 
virConfPtr conf); virConfValuePtr virConfGetValue (virConfPtr conf,
const char * setting); virConfPtr virConfReadMem (const char * memory,
int len); int virConfFree (virConfPtr conf); virConfPtr virConfReadFile (const char * filename); int virConfWriteMem (char * memory,
int * len,
virConfPtr conf);

Description

Details

Structure virConf

struct _virConf {
The content of this structure is not made public by the API.
} virConf;


Typedef virConfPtr

virConf * virConfPtr;

a pointer to a parsed configuration file


Enum virConfType

enum virConfType {
    VIR_CONF_NONE = 0 /* undefined */
    VIR_CONF_LONG = 1 /* a long int */
    VIR_CONF_STRING = 2 /* a string */
    VIR_CONF_LIST = 3 /*  a list */
};


Structure virConfValue

struct _virConfValue {
    virConfType	type	: the virConfType
    virConfValuePtr	next	: next element if in a list
    long	l	: long integer
    char *	str	: pointer to 0 terminated string
    virConfValuePtr	list	: list of a list
} virConfValue;


Typedef virConfValuePtr

virConfValue * virConfValuePtr;


virConfFree ()

int	virConfFree			(virConfPtr conf)

Frees all data associated to the handle

conf:a configuration file handle
Returns:0 in case of success, -1 in case of error.

virConfGetValue ()

virConfValuePtr	virConfGetValue		(virConfPtr conf, 
const char * setting)

Lookup the value associated to this entry in the configuration file

conf:a configuration file handle
setting:
Returns:a pointer to the value or NULL if the lookup failed, the data associated will be freed when virConfFree() is called

virConfReadFile ()

virConfPtr	virConfReadFile		(const char * filename)

Reads a configuration file.

filename:the path to the configuration file.
Returns:an handle to lookup settings or NULL if it failed to read or parse the file, use virConfFree() to free the data.

virConfReadMem ()

virConfPtr	virConfReadMem		(const char * memory, 
int len)

Reads a configuration file loaded in memory. The string can be zero terminated in which case @len can be 0

memory:pointer to the content of the configuration file
len:lenght in byte
Returns:an handle to lookup settings or NULL if it failed to parse the content, use virConfFree() to free the data.

virConfWriteFile ()

int	virConfWriteFile		(const char * filename, 
virConfPtr conf)

Writes a configuration file back to a file.

filename:the path to the configuration file.
conf:the conf
Returns:the number of bytes written or -1 in case of error.

virConfWriteMem ()

int	virConfWriteMem			(char * memory, 
int * len,
virConfPtr conf)

Writes a configuration file back to a memory area. @len is an IN/OUT parameter, it indicates the size available in bytes, and on output the size required for the configuration file (even if the call fails due to insufficient space).

memory:pointer to the memory to store the config file
len:pointer to the lenght in byte of the store, on output the size
conf:the conf
Returns:the number of bytes written or -1 in case of error.