Change the format of the revprops block sent in svnserve for
[svn.git] / subversion / libsvn_subr / config_impl.h
blob9888aee08875dd2c5e34a9a5fe7b0714737de2f5
1 /*
2 * config_impl.h : private header for the config file implementation.
4 * ====================================================================
5 * Copyright (c) 2000-2004 CollabNet. All rights reserved.
7 * This software is licensed as described in the file COPYING, which
8 * you should have received as part of this distribution. The terms
9 * are also available at http://subversion.tigris.org/license-1.html.
10 * If newer versions of this license are posted there, you may use a
11 * newer version instead, at your option.
13 * This software consists of voluntary contributions made by many
14 * individuals. For exact contribution history, see the revision
15 * history and logs, available at http://subversion.tigris.org/.
16 * ====================================================================
21 #ifndef SVN_LIBSVN_SUBR_CONFIG_IMPL_H
22 #define SVN_LIBSVN_SUBR_CONFIG_IMPL_H
24 #define APR_WANT_STDIO
25 #include <apr_want.h>
27 #include <apr_hash.h>
28 #include "svn_types.h"
29 #include "svn_string.h"
30 #include "svn_config.h"
31 #include "svn_private_config.h"
33 #ifdef __cplusplus
34 extern "C" {
35 #endif /* __cplusplus */
38 /* The configuration data. This is a superhash of sections and options. */
39 struct svn_config_t
41 /* Table of cfg_section_t's. */
42 apr_hash_t *sections;
44 /* Pool for hash tables, table entries and unexpanded values */
45 apr_pool_t *pool;
47 /* Pool for expanded values -- this is separate, so that we can
48 clear it when modifying the config data. */
49 apr_pool_t *x_pool;
51 /* Indicates that some values in the configuration have been expanded. */
52 svn_boolean_t x_values;
54 /* Temporary string used for lookups. (Using a stringbuf so that
55 frequent resetting is efficient.) */
56 svn_stringbuf_t *tmp_key;
58 /* Temporary value used for expanded default values in svn_config_get.
59 (Using a stringbuf so that frequent resetting is efficient.) */
60 svn_stringbuf_t *tmp_value;
64 /* Read sections and options from a file. */
65 svn_error_t *svn_config__parse_file(svn_config_t *cfg,
66 const char *file,
67 svn_boolean_t must_exist,
68 apr_pool_t *pool);
70 /* The name of the magic [DEFAULT] section. */
71 #define SVN_CONFIG__DEFAULT_SECTION "DEFAULT"
74 #ifdef WIN32
75 /* Get the common or user-specific AppData folder */
76 svn_error_t *svn_config__win_config_path(const char **folder,
77 int system_path,
78 apr_pool_t *pool);
80 /* Read sections and options from the Windows Registry. */
81 svn_error_t *svn_config__parse_registry(svn_config_t *cfg,
82 const char *file,
83 svn_boolean_t must_exist,
84 apr_pool_t *pool);
86 /* ### It's unclear to me whether this registry stuff should get the
87 double underscore or not, and if so, where the extra underscore
88 would go. Thoughts? -kff */
89 # define SVN_REGISTRY_PREFIX "REGISTRY:"
90 # define SVN_REGISTRY_PREFIX_LEN ((sizeof(SVN_REGISTRY_PREFIX)) - 1)
91 # define SVN_REGISTRY_HKLM "HKLM\\"
92 # define SVN_REGISTRY_HKLM_LEN ((sizeof(SVN_REGISTRY_HKLM)) - 1)
93 # define SVN_REGISTRY_HKCU "HKCU\\"
94 # define SVN_REGISTRY_HKCU_LEN ((sizeof(SVN_REGISTRY_HKCU)) - 1)
95 # define SVN_REGISTRY_PATH "Software\\Tigris.org\\Subversion\\"
96 # define SVN_REGISTRY_PATH_LEN ((sizeof(SVN_REGISTRY_PATH)) - 1)
97 # define SVN_REGISTRY_SYS_CONFIG_PATH \
98 SVN_REGISTRY_PREFIX \
99 SVN_REGISTRY_HKLM \
100 SVN_REGISTRY_PATH
101 # define SVN_REGISTRY_USR_CONFIG_PATH \
102 SVN_REGISTRY_PREFIX \
103 SVN_REGISTRY_HKCU \
104 SVN_REGISTRY_PATH
105 #endif /* WIN32 */
107 /* System-wide and configuration subdirectory names.
108 NOTE: Don't use these directly; call svn_config__sys_config_path()
109 or svn_config__user_config_path() instead. */
110 #ifdef WIN32
111 # define SVN_CONFIG__SUBDIRECTORY "Subversion"
112 #else /* ! WIN32 */
113 # define SVN_CONFIG__SYS_DIRECTORY "/etc/subversion"
114 # define SVN_CONFIG__USR_DIRECTORY ".subversion"
115 #endif /* WIN32 */
117 /* The description/instructions file in the config directory. */
118 #define SVN_CONFIG__USR_README_FILE "README.txt"
120 /* The name of the main authentication subdir in the config directory */
121 #define SVN_CONFIG__AUTH_SUBDIR "auth"
123 /* Set *PATH_P to the path to config file FNAME in the system
124 configuration area, allocated in POOL. If FNAME is NULL, set
125 *PATH_P to the directory name of the system config area, either
126 allocated in POOL or a static constant string.
128 If the system configuration area cannot be located (possible under
129 Win32), set *PATH_P to NULL regardless of FNAME. */
130 svn_error_t *
131 svn_config__sys_config_path(const char **path_p,
132 const char *fname,
133 apr_pool_t *pool);
136 /* Set *PATH_P to the path to config file FNAME in the user's personal
137 configuration area; if FNAME is NULL, set *PATH_P to the directory
138 name of the user's config area. Allocate *PATH_P in POOL.
140 If the user's personal configuration area cannot be located (most
141 likely under Win32), set *PATH_P to NULL regardless of FNAME.
143 CONFIG_DIR overrides this and if set *PATH_P is set to it.
145 svn_error_t *
146 svn_config__user_config_path(const char *config_dir,
147 const char **path_p,
148 const char *fname,
149 apr_pool_t *pool);
152 /* Open a config file FILENAME with mode MODE. FILENAME is encoded in
153 UTF-8, so use POOL for any temporary storage needed for
154 conversions. */
155 svn_error_t *
156 svn_config__open_file(FILE **pfile,
157 const char *filename,
158 const char *mode,
159 apr_pool_t *pool);
162 /* Stubs for allowing 1.0.x Apache modules to be mixed with 1.1.x libraries. */
163 typedef svn_boolean_t(*svn_config__section_enumerator_t)
164 (const char *name, void *baton);
166 int svn_config__enumerate_sections(svn_config_t *cfg,
167 svn_config__section_enumerator_t callback,
168 void *baton);
170 #ifdef __cplusplus
172 #endif /* __cplusplus */
174 #endif /* SVN_LIBSVN_SUBR_CONFIG_IMPL_H */