# Module conf from libvirt

## Table of Contents

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

    Typedef virConf * virConfPtr

    Enum virConfType

    Structure virConfValue
    struct _virConfValue

    Typedef virConfValue * virConfValuePtr

    int	virConfFree			(virConfPtr conf)

    virConfValuePtr	virConfGetValue		(virConfPtr conf,
    					 const char * setting)

    virConfPtr	virConfReadFile		(const char * filename)

    virConfPtr	virConfReadMem		(const char * memory,
    					 int len)

    int	virConfWriteFile		(const char * filename,
    					 virConfPtr conf)

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

## Description

### Structure virConf

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

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

    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
    }

### Function: 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.

### Function: 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

### Function: 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.

### Function: 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.

### Function: 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.

### Function: 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.

### main menu

- Home
- API Menu
- C code examples
- Recent Changes

### related links

- Mail archive
- Open bugs
- virt-manager
- Perl bindings
- Xen project

Graphics and design by Diana Fong