2 * config_impl.h : private header for the config file implementation.
4 * ====================================================================
5 * Licensed to the Apache Software Foundation (ASF) under one
6 * or more contributor license agreements. See the NOTICE file
7 * distributed with this work for additional information
8 * regarding copyright ownership. The ASF licenses this file
9 * to you under the Apache License, Version 2.0 (the
10 * "License"); you may not use this file except in compliance
11 * with the License. You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing,
16 * software distributed under the License is distributed on an
17 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18 * KIND, either express or implied. See the License for the
19 * specific language governing permissions and limitations
21 * ====================================================================
26 #ifndef SVN_LIBSVN_SUBR_CONFIG_IMPL_H
27 #define SVN_LIBSVN_SUBR_CONFIG_IMPL_H
29 #define APR_WANT_STDIO
33 #include "svn_types.h"
34 #include "svn_string.h"
36 #include "svn_config.h"
40 #endif /* __cplusplus */
43 /* The configuration data. This is a superhash of sections and options. */
46 /* Table of cfg_section_t's. */
49 /* Pool for hash tables, table entries and unexpanded values.
50 Also, parent pool for temporary pools. */
53 /* Pool for expanded values -- this is separate, so that we can
54 clear it when modifying the config data. */
57 /* Indicates that some values in the configuration have been expanded. */
58 svn_boolean_t x_values;
60 /* Temporary string used for lookups. (Using a stringbuf so that
61 frequent resetting is efficient.) */
62 svn_stringbuf_t *tmp_key;
64 /* Temporary value used for expanded default values in svn_config_get.
65 (Using a stringbuf so that frequent resetting is efficient.) */
66 svn_stringbuf_t *tmp_value;
68 /* Specifies whether section names are populated case sensitively. */
69 svn_boolean_t section_names_case_sensitive;
71 /* Specifies whether option names are populated case sensitively. */
72 svn_boolean_t option_names_case_sensitive;
74 /* When set, all modification attempts will be ignored.
75 * In debug mode, we will trigger an assertion. */
76 svn_boolean_t read_only;
79 /* Read sections and options from a file. */
80 svn_error_t *svn_config__parse_file(svn_config_t *cfg,
82 svn_boolean_t must_exist,
85 /* Read sections and options from a stream. */
86 svn_error_t *svn_config__parse_stream(svn_config_t *cfg,
88 apr_pool_t *result_pool,
89 apr_pool_t *scratch_pool);
91 /* The name of the magic [DEFAULT] section. */
92 #define SVN_CONFIG__DEFAULT_SECTION "DEFAULT"
96 /* Get the common or user-specific AppData folder */
97 svn_error_t *svn_config__win_config_path(const char **folder,
98 svn_boolean_t system_path,
99 apr_pool_t *result_pool,
100 apr_pool_t *scratch_pool);
102 /* Read sections and options from the Windows Registry. */
103 svn_error_t *svn_config__parse_registry(svn_config_t *cfg,
105 svn_boolean_t must_exist,
108 /* ### It's unclear to me whether this registry stuff should get the
109 double underscore or not, and if so, where the extra underscore
110 would go. Thoughts? -kff */
111 # define SVN_REGISTRY_PREFIX "REGISTRY:"
112 # define SVN_REGISTRY_PREFIX_LEN ((sizeof(SVN_REGISTRY_PREFIX)) - 1)
113 # define SVN_REGISTRY_HKLM "HKLM\\"
114 # define SVN_REGISTRY_HKLM_LEN ((sizeof(SVN_REGISTRY_HKLM)) - 1)
115 # define SVN_REGISTRY_HKCU "HKCU\\"
116 # define SVN_REGISTRY_HKCU_LEN ((sizeof(SVN_REGISTRY_HKCU)) - 1)
117 # define SVN_REGISTRY_PATH "Software\\Tigris.org\\Subversion\\"
118 # define SVN_REGISTRY_PATH_LEN ((sizeof(SVN_REGISTRY_PATH)) - 1)
119 # define SVN_REGISTRY_SYS_CONFIG_PATH \
120 SVN_REGISTRY_PREFIX \
123 # define SVN_REGISTRY_USR_CONFIG_PATH \
124 SVN_REGISTRY_PREFIX \
129 /* System-wide and configuration subdirectory names.
130 NOTE: Don't use these directly; call svn_config__sys_config_path()
131 or svn_config_get_user_config_path() instead. */
133 # define SVN_CONFIG__SUBDIRECTORY "Subversion"
134 #elif defined __HAIKU__ /* HAIKU */
135 # define SVN_CONFIG__SYS_DIRECTORY "subversion"
136 # define SVN_CONFIG__USR_DIRECTORY "subversion"
137 #else /* ! WIN32 && ! __HAIKU__ */
138 # define SVN_CONFIG__SYS_DIRECTORY "/etc/subversion"
139 # define SVN_CONFIG__USR_DIRECTORY ".subversion"
142 /* The description/instructions file in the config directory. */
143 #define SVN_CONFIG__USR_README_FILE "README.txt"
145 /* The name of the main authentication subdir in the config directory */
146 #define SVN_CONFIG__AUTH_SUBDIR "auth"
148 /* Set *PATH_P to the path to config file FNAME in the system
149 configuration area, allocated in POOL. If FNAME is NULL, set
150 *PATH_P to the directory name of the system config area, either
151 allocated in POOL or a static constant string.
153 If the system configuration area cannot be located (possible under
154 Win32), set *PATH_P to NULL regardless of FNAME. */
156 svn_config__sys_config_path(const char **path_p,
163 #endif /* __cplusplus */
165 #endif /* SVN_LIBSVN_SUBR_CONFIG_IMPL_H */