svn_config.h File Reference

Accessing SVN configuration files. More...

#include <apr_pools.h>
#include "svn_types.h"
#include "svn_error.h"

Go to the source code of this file.

Typedefs

typedef svn_config_t svn_config_t
 Opaque structure describing a set of configuration options.
typedef svn_boolean_t(*) svn_config_section_enumerator_t (const char *name, void *baton)
 Similar to svn_config_section_enumerator2_t, but is not provided with a memory pool argument.
typedef svn_boolean_t(*) svn_config_section_enumerator2_t (const char *name, void *baton, apr_pool_t *pool)
 A callback function used in enumerating config sections.
typedef svn_boolean_t(*) svn_config_enumerator_t (const char *name, const char *value, void *baton)
 Similar to svn_config_enumerator2_t, but is not provided with a memory pool argument.
typedef svn_boolean_t(*) svn_config_enumerator2_t (const char *name, const char *value, void *baton, apr_pool_t *pool)
 A callback function used in enumerating config options.

Functions

svn_error_tsvn_config_get_config (apr_hash_t **cfg_hash, const char *config_dir, apr_pool_t *pool)
 Read configuration information from the standard sources and merge it into the hash *cfg_hash.
svn_error_tsvn_config_read (svn_config_t **cfgp, const char *file, svn_boolean_t must_exist, apr_pool_t *pool)
 Read configuration data from file (a file or registry path) into *cfgp, allocated in pool.
svn_error_tsvn_config_merge (svn_config_t *cfg, const char *file, svn_boolean_t must_exist)
 Like svn_config_read(), but merges the configuration data from file (a file or registry path) into *cfg, which was previously returned from svn_config_read().
void svn_config_get (svn_config_t *cfg, const char **valuep, const char *section, const char *option, const char *default_value)
 Find the value of a (section, option) pair in cfg, set *valuep to the value.
void svn_config_set (svn_config_t *cfg, const char *section, const char *option, const char *value)
 Add or replace the value of a (section, option) pair in cfg with value.
svn_error_tsvn_config_get_bool (svn_config_t *cfg, svn_boolean_t *valuep, const char *section, const char *option, svn_boolean_t default_value)
 Like svn_config_get(), but for boolean values.
void svn_config_set_bool (svn_config_t *cfg, const char *section, const char *option, svn_boolean_t value)
 Like svn_config_set(), but for boolean values.
int svn_config_enumerate_sections (svn_config_t *cfg, svn_config_section_enumerator_t callback, void *baton)
 Similar to svn_config_enumerate_sections2(), but uses a memory pool of cfg instead of one that is explicitely provided.
int svn_config_enumerate_sections2 (svn_config_t *cfg, svn_config_section_enumerator2_t callback, void *baton, apr_pool_t *pool)
 Enumerate the sections, passing baton and the current section's name to callback.
int svn_config_enumerate (svn_config_t *cfg, const char *section, svn_config_enumerator_t callback, void *baton)
 Similar to svn_config_enumerate2(), but uses a memory pool of cfg instead of one that is explicitely provided.
int svn_config_enumerate2 (svn_config_t *cfg, const char *section, svn_config_enumerator2_t callback, void *baton, apr_pool_t *pool)
 Enumerate the options in section, passing baton and the current option's name and value to callback.
svn_boolean_t svn_config_has_section (svn_config_t *cfg, const char *section)
 Return TRUE if section exists in cfg, FALSE otherwise.
const char * svn_config_find_group (svn_config_t *cfg, const char *key, const char *master_section, apr_pool_t *pool)
 Enumerate the group master_section in cfg.
const char * svn_config_get_server_setting (svn_config_t *cfg, const char *server_group, const char *option_name, const char *default_value)
 Retrieve value corresponding to option_name for a given server_group in cfg , or return default_value if none is found.
svn_error_tsvn_config_get_server_setting_int (svn_config_t *cfg, const char *server_group, const char *option_name, apr_int64_t default_value, apr_int64_t *result_value, apr_pool_t *pool)
 Retrieve value into result_value corresponding to option_name for a given server_group in cfg, or return default_value if none is found.
svn_error_tsvn_config_ensure (const char *config_dir, apr_pool_t *pool)
 Try to ensure that the user's ~/.subversion/ area exists, and create no-op template files for any absent config files.
svn_error_tsvn_config_read_auth_data (apr_hash_t **hash, const char *cred_kind, const char *realmstring, const char *config_dir, apr_pool_t *pool)
 Use cred_kind and realmstring to locate a file within the ~/.subversion/auth/ area.
svn_error_tsvn_config_write_auth_data (apr_hash_t *hash, const char *cred_kind, const char *realmstring, const char *config_dir, apr_pool_t *pool)
 Use cred_kind and realmstring to create or overwrite a file within the ~/.subversion/auth/ area.


Detailed Description

Accessing SVN configuration files.

Definition in file svn_config.h.


Typedef Documentation

typedef svn_boolean_t(*) svn_config_enumerator2_t(const char *name, const char *value, void *baton, apr_pool_t *pool)

A callback function used in enumerating config options.

See svn_config_enumerate2() for the details of this type.

Since:
New in 1.3.

Definition at line 298 of file svn_config.h.

typedef svn_boolean_t(*) svn_config_enumerator_t(const char *name, const char *value, void *baton)

Similar to svn_config_enumerator2_t, but is not provided with a memory pool argument.

See svn_config_enumerate() for the details of this type.

Deprecated:
Provided for backwards compatibility with the 1.2 API.

Definition at line 279 of file svn_config.h.

typedef svn_boolean_t(*) svn_config_section_enumerator2_t(const char *name, void *baton, apr_pool_t *pool)

A callback function used in enumerating config sections.

See svn_config_enumerate_sections2() for the details of this type.

Since:
New in 1.3.

Definition at line 254 of file svn_config.h.

typedef svn_boolean_t(*) svn_config_section_enumerator_t(const char *name, void *baton)

Similar to svn_config_section_enumerator2_t, but is not provided with a memory pool argument.

See svn_config_enumerate_sections() for the details of this type.

Deprecated:
Provided for backwards compatibility with the 1.2 API.

Definition at line 236 of file svn_config.h.


Function Documentation

svn_error_t* svn_config_ensure ( const char *  config_dir,
apr_pool_t *  pool 
)

Try to ensure that the user's ~/.subversion/ area exists, and create no-op template files for any absent config files.

Use pool for any temporary allocation. If config_dir is not NULL it specifies a directory from which to read the config overriding all other sources.

Don't error if something exists but is the wrong kind (for example, ~/.subversion exists but is a file, or ~/.subversion/servers exists but is a directory).

Also don't error if trying to create something and failing -- it's okay for the config area or its contents not to be created. However, if creating a config template file succeeds, return an error if unable to initialize its contents.

int svn_config_enumerate ( svn_config_t cfg,
const char *  section,
svn_config_enumerator_t  callback,
void *  baton 
)

Similar to svn_config_enumerate2(), but uses a memory pool of cfg instead of one that is explicitely provided.

Deprecated:
Provided for backwards compatibility with the 1.2 API.

int svn_config_enumerate2 ( svn_config_t cfg,
const char *  section,
svn_config_enumerator2_t  callback,
void *  baton,
apr_pool_t *  pool 
)

Enumerate the options in section, passing baton and the current option's name and value to callback.

Continue the enumeration if callback returns TRUE. Return the number of times callback was called.

### kff asks: A more usual interface is to continue enumerating while callback does not return error, and if callback does return error, to return the same error (or a wrapping of it) from svn_config_enumerate(). What's the use case for svn_config_enumerate()? Is it more likely to need to break out of an enumeration early, with no error, than an invocation of callback is likely to need to return an error? ###

callback's name and value parameters are only valid for the duration of the call.

Since:
New in 1.3.

int svn_config_enumerate_sections ( svn_config_t cfg,
svn_config_section_enumerator_t  callback,
void *  baton 
)

Similar to svn_config_enumerate_sections2(), but uses a memory pool of cfg instead of one that is explicitely provided.

Deprecated:
Provided for backwards compatibility with the 1.2 API.

int svn_config_enumerate_sections2 ( svn_config_t cfg,
svn_config_section_enumerator2_t  callback,
void *  baton,
apr_pool_t *  pool 
)

Enumerate the sections, passing baton and the current section's name to callback.

Continue the enumeration if callback returns TRUE. Return the number of times callback was called.

### See kff's comment to svn_config_enumerate2(). It applies to this function, too. ###

callback's name parameter is only valid for the duration of the call.

Since:
New in 1.3.

const char* svn_config_find_group ( svn_config_t cfg,
const char *  key,
const char *  master_section,
apr_pool_t *  pool 
)

Enumerate the group master_section in cfg.

Each variable value is interpreted as a list of glob patterns (separated by comma and optional whitespace). Return the name of the first variable whose value matches key, or NULL if no variable matches.

void svn_config_get ( svn_config_t cfg,
const char **  valuep,
const char *  section,
const char *  option,
const char *  default_value 
)

Find the value of a (section, option) pair in cfg, set *valuep to the value.

If cfg is NULL, just sets *valuep to default_value. If the value does not exist, expand and return default_value. default_value can be NULL.

The returned value will be valid at least until the next call to svn_config_get(), or for the lifetime of default_value. It is safest to consume the returned value immediately.

This function may change cfg by expanding option values.

svn_error_t* svn_config_get_bool ( svn_config_t cfg,
svn_boolean_t valuep,
const char *  section,
const char *  option,
svn_boolean_t  default_value 
)

Like svn_config_get(), but for boolean values.

Parses the option as a boolean value. The recognized representations are 'TRUE'/'FALSE', 'yes'/'no', 'on'/'off', '1'/'0'; case does not matter. Returns an error if the option doesn't contain a known string.

svn_error_t* svn_config_get_config ( apr_hash_t **  cfg_hash,
const char *  config_dir,
apr_pool_t *  pool 
)

Read configuration information from the standard sources and merge it into the hash *cfg_hash.

If config_dir is not NULL it specifies a directory from which to read the configuration files, overriding all other sources. Otherwise, first read any system-wide configurations (from a file or from the registry), then merge in personal configurations (again from file or registry). The hash and all its data are allocated in pool.

*cfg_hash is a hash whose keys are const char * configuration categories (SVN_CONFIG_CATEGORY_SERVERS, SVN_CONFIG_CATEGORY_CONFIG, etc.) and whose values are the svn_config_t * items representing the configuration values for that category.

const char* svn_config_get_server_setting ( svn_config_t cfg,
const char *  server_group,
const char *  option_name,
const char *  default_value 
)

Retrieve value corresponding to option_name for a given server_group in cfg , or return default_value if none is found.

The config will first be checked for a default, then will be checked for an override in a server group.

svn_error_t* svn_config_get_server_setting_int ( svn_config_t cfg,
const char *  server_group,
const char *  option_name,
apr_int64_t  default_value,
apr_int64_t *  result_value,
apr_pool_t *  pool 
)

Retrieve value into result_value corresponding to option_name for a given server_group in cfg, or return default_value if none is found.

The config will first be checked for a default, then will be checked for an override in a server group. If the value found is not a valid integer, a svn_error_t* will be returned.

svn_boolean_t svn_config_has_section ( svn_config_t cfg,
const char *  section 
)

Return TRUE if section exists in cfg, FALSE otherwise.

Since:
New in 1.4.

svn_error_t* svn_config_merge ( svn_config_t cfg,
const char *  file,
svn_boolean_t  must_exist 
)

Like svn_config_read(), but merges the configuration data from file (a file or registry path) into *cfg, which was previously returned from svn_config_read().

This function invalidates all value expansions in cfg, so that the next svn_config_get() takes the modifications into account.

svn_error_t* svn_config_read ( svn_config_t **  cfgp,
const char *  file,
svn_boolean_t  must_exist,
apr_pool_t *  pool 
)

Read configuration data from file (a file or registry path) into *cfgp, allocated in pool.

If file does not exist, then if must_exist, return an error, otherwise return an empty svn_config_t.

void svn_config_set ( svn_config_t cfg,
const char *  section,
const char *  option,
const char *  value 
)

Add or replace the value of a (section, option) pair in cfg with value.

This function invalidates all value expansions in cfg.

To remove an option, pass NULL for the value.

void svn_config_set_bool ( svn_config_t cfg,
const char *  section,
const char *  option,
svn_boolean_t  value 
)

Like svn_config_set(), but for boolean values.

Sets the option to 'TRUE'/'FALSE', depending on value.


Generated on Wed Oct 22 14:54:29 2008 for Subversion by  doxygen 1.4.7