]> granicus.if.org Git - apache/blob - include/ap_regkey.h
add "-l" option to indicate interval is based on localtime not gmt
[apache] / include / ap_regkey.h
1 /* Copyright 2002-2004 The Apache Software Foundation
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15
16 #ifndef AP_REGKEY_H
17 #define AP_REGKEY_H
18
19 #if defined(WIN32) || defined(DOXYGEN)
20
21 #include "apr.h"
22 #include "apr_pools.h"
23 #include "ap_config.h"      /* Just for AP_DECLARE */
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 typedef struct ap_regkey_t ap_regkey_t;
30
31 /* Used to recover AP_REGKEY_* constants 
32  */
33 AP_DECLARE(const ap_regkey_t *) ap_regkey_const(int i);
34
35 /**
36  * @file ap_regkey.h
37  * @brief APR-style Win32 Registry Manipulation
38  */
39
40 /**
41  * Win32 Only: Constants for ap_regkey_open()
42  */
43 #define AP_REGKEY_CLASSES_ROOT         ap_regkey_const(0)
44 #define AP_REGKEY_CURRENT_CONFIG       ap_regkey_const(1)
45 #define AP_REGKEY_CURRENT_USER         ap_regkey_const(2)
46 #define AP_REGKEY_LOCAL_MACHINE        ap_regkey_const(3)
47 #define AP_REGKEY_USERS                ap_regkey_const(4)
48 #define AP_REGKEY_PERFORMANCE_DATA     ap_regkey_const(5)
49 #define AP_REGKEY_DYN_DATA             ap_regkey_const(6)
50
51 /**
52  * Win32 Only: Flags for ap_regkey_value_set()
53  */
54 #define AP_REGKEY_EXPAND               0x0001
55
56 /**
57  * Win32 Only: Open the specified registry key.
58  * @param newkey The opened registry key
59  * @param parentkey The open registry key of the parent, or one of
60  * <PRE>
61  *           AP_REGKEY_CLASSES_ROOT
62  *           AP_REGKEY_CURRENT_CONFIG
63  *           AP_REGKEY_CURRENT_USER
64  *           AP_REGKEY_LOCAL_MACHINE
65  *           AP_REGKEY_USERS
66  *           AP_REGKEY_PERFORMANCE_DATA 
67  *           AP_REGKEY_DYN_DATA 
68  * </PRE>
69  * @param keyname The path of the key relative to the parent key
70  * @param flags Or'ed value of:
71  * <PRE>
72  *           APR_READ             open key for reading
73  *           APR_WRITE            open key for writing
74  *           APR_CREATE           create the key if it doesn't exist
75  *           APR_EXCL             return error if APR_CREATE and key exists
76  * </PRE>
77  * @param pool The pool in which newkey is allocated
78  */
79 AP_DECLARE(apr_status_t) ap_regkey_open(ap_regkey_t **newkey, 
80                                         const ap_regkey_t *parentkey,
81                                         const char *keyname,
82                                         apr_int32_t flags, 
83                                         apr_pool_t *pool);
84
85 /**
86  * Win32 Only: Close the registry key opened or created by ap_regkey_open().
87  * @param key The registry key to close
88  */
89 AP_DECLARE(apr_status_t) ap_regkey_close(ap_regkey_t *key);
90
91 /**
92  * Win32 Only: Remove the given registry key.
93  * @param parentkey The open registry key of the parent, or one of
94  * <PRE>
95  *           AP_REGKEY_CLASSES_ROOT
96  *           AP_REGKEY_CURRENT_CONFIG
97  *           AP_REGKEY_CURRENT_USER
98  *           AP_REGKEY_LOCAL_MACHINE
99  *           AP_REGKEY_USERS
100  *           AP_REGKEY_PERFORMANCE_DATA 
101  *           AP_REGKEY_DYN_DATA 
102  * </PRE>
103  * @param keyname The path of the key relative to the parent key
104  * @param pool The pool used for temp allocations
105  * @remark ap_regkey_remove() is not recursive, although it removes
106  * all values within the given keyname, it will not remove a key 
107  * containing subkeys.
108  */
109 AP_DECLARE(apr_status_t) ap_regkey_remove(const ap_regkey_t *parent, 
110                                           const char *keyname,
111                                           apr_pool_t *pool);
112
113 /**
114  * Win32 Only: Retrieve a registry value string from an open key.
115  * @param result The string value retrieved 
116  * @param key The registry key to retrieve the value from
117  * @param valuename The named value to retrieve (pass "" for the default)
118  * @param pool The pool used to store the result
119  * @remark There is no toggle to prevent environment variable expansion
120  * if the registry value is set with AP_REG_EXPAND (REG_EXPAND_SZ), such
121  * expansions are always performed.
122  */
123 AP_DECLARE(apr_status_t) ap_regkey_value_get(char **result, 
124                                              ap_regkey_t *key, 
125                                              const char *valuename, 
126                                              apr_pool_t *pool);
127
128 /**
129  * Win32 Only: Store a registry value string into an open key.
130  * @param key The registry key to store the value into
131  * @param valuename The named value to store (pass "" for the default)
132  * @param value The string to store for the named value
133  * @param flags The option AP_REGKEY_EXPAND or 0, where AP_REGKEY_EXPAND
134  * values will find all %foo% variables expanded from the environment.
135  * @param pool The pool used for temp allocations
136  */
137 AP_DECLARE(apr_status_t) ap_regkey_value_set(ap_regkey_t *key, 
138                                              const char *valuename, 
139                                              const char *value, 
140                                              apr_int32_t flags,
141                                              apr_pool_t *pool);
142
143 /**
144  * Win32 Only: Retrieve a raw byte value from an open key.
145  * @param result The raw bytes value retrieved 
146  * @param resultsize Pointer to a variable to store the number raw bytes retrieved 
147  * @param key The registry key to retrieve the value from
148  * @param valuename The named value to retrieve (pass "" for the default)
149  * @param pool The pool used to store the result
150  */
151 AP_DECLARE(apr_status_t) ap_regkey_value_raw_get(void **result, 
152                                                  apr_size_t *resultsize,
153                                                  apr_int32_t *resulttype,
154                                                  ap_regkey_t *key, 
155                                                  const char *valuename, 
156                                                  apr_pool_t *pool);
157
158 /**
159  * Win32 Only: Store a raw bytes value into an open key.
160  * @param key The registry key to store the value into
161  * @param valuename The named value to store (pass "" for the default)
162  * @param value The bytes to store for the named value
163  * @param valuesize The number of bytes for value
164  * @param valuetype The 
165  * values will find all %foo% variables expanded from the environment.
166  * @param pool The pool used for temp allocations
167  */
168 AP_DECLARE(apr_status_t) ap_regkey_value_raw_set(ap_regkey_t *key, 
169                                                  const char *valuename, 
170                                                  const void *value, 
171                                                  apr_size_t  valuesize,
172                                                  apr_int32_t valuetype,
173                                                  apr_pool_t *pool);
174
175 /**
176  * Win32 Only: Retrieve a registry value string from an open key.
177  * @param result The string elements retrieved from a REG_MULTI_SZ string array
178  * @param key The registry key to retrieve the value from
179  * @param valuename The named value to retrieve (pass "" for the default)
180  * @param pool The pool used to store the result
181  */
182 AP_DECLARE(apr_status_t) ap_regkey_value_array_get(apr_array_header_t **result, 
183                                                    ap_regkey_t *key,
184                                                    const char *valuename, 
185                                                    apr_pool_t *pool);
186
187 /**
188  * Win32 Only: Store a registry value string array into an open key.
189  * @param key The registry key to store the value into
190  * @param valuename The named value to store (pass "" for the default)
191  * @param nelts The string elements to store in a REG_MULTI_SZ string array
192  * @param elts The number of elements in the elts string array
193  * @param pool The pool used for temp allocations
194  */
195 AP_DECLARE(apr_status_t) ap_regkey_value_array_set(ap_regkey_t *key, 
196                                                    const char *valuename, 
197                                                    int nelts, 
198                                                    const char * const * elts,
199                                                    apr_pool_t *pool);
200
201 /**
202  * Win32 Only: Remove a registry value from an open key.
203  * @param key The registry key to remove the value from
204  * @param valuename The named value to remove (pass "" for the default)
205  * @param pool The pool used for temp allocations
206  */
207 AP_DECLARE(apr_status_t) ap_regkey_value_remove(const ap_regkey_t *key, 
208                                                 const char *valuename,
209                                                 apr_pool_t *pool);
210
211 #ifdef __cplusplus
212 }
213 #endif
214
215 #endif /* def WIN32 || def DOXYGEN */
216
217 #endif /* AP_REGKEY_H */