Apache Portable Runtime Utility Library
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
apr_dbm.h
Go to the documentation of this file.
1 /* Licensed to the Apache Software Foundation (ASF) under one or more
2  * contributor license agreements. See the NOTICE file distributed with
3  * this work for additional information regarding copyright ownership.
4  * The ASF licenses this file to You under the Apache License, Version 2.0
5  * (the "License"); you may not use this file except in compliance with
6  * the License. You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef APR_DBM_H
18 #define APR_DBM_H
19 
20 #include "apu.h"
21 #include "apr.h"
22 #include "apr_errno.h"
23 #include "apr_pools.h"
24 #include "apr_file_info.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
42 typedef struct apr_dbm_t apr_dbm_t;
43 
47 typedef struct
48 {
50  char *dptr;
52  apr_size_t dsize;
53 } apr_datum_t;
54 
55 /* modes to open the DB */
56 #define APR_DBM_READONLY 1
57 #define APR_DBM_READWRITE 2
58 #define APR_DBM_RWCREATE 3
59 #define APR_DBM_RWTRUNC 4
89 APU_DECLARE(apr_status_t) apr_dbm_open_ex(apr_dbm_t **dbm, const char* type,
90  const char *name,
91  apr_int32_t mode, apr_fileperms_t perm,
92  apr_pool_t *cntxt);
93 
94 
111 APU_DECLARE(apr_status_t) apr_dbm_open(apr_dbm_t **dbm, const char *name,
112  apr_int32_t mode, apr_fileperms_t perm,
113  apr_pool_t *cntxt);
114 
119 APU_DECLARE(void) apr_dbm_close(apr_dbm_t *dbm);
120 
127 APU_DECLARE(apr_status_t) apr_dbm_fetch(apr_dbm_t *dbm, apr_datum_t key,
128  apr_datum_t *pvalue);
135 APU_DECLARE(apr_status_t) apr_dbm_store(apr_dbm_t *dbm, apr_datum_t key,
136  apr_datum_t value);
137 
144 APU_DECLARE(apr_status_t) apr_dbm_delete(apr_dbm_t *dbm, apr_datum_t key);
145 
151 APU_DECLARE(int) apr_dbm_exists(apr_dbm_t *dbm, apr_datum_t key);
152 
158 APU_DECLARE(apr_status_t) apr_dbm_firstkey(apr_dbm_t *dbm, apr_datum_t *pkey);
159 
165 APU_DECLARE(apr_status_t) apr_dbm_nextkey(apr_dbm_t *dbm, apr_datum_t *pkey);
166 
172 APU_DECLARE(void) apr_dbm_freedatum(apr_dbm_t *dbm, apr_datum_t data);
173 
183 APU_DECLARE(char *) apr_dbm_geterror(apr_dbm_t *dbm, int *errcode,
184  char *errbuf, apr_size_t errbufsize);
199 APU_DECLARE(apr_status_t) apr_dbm_get_usednames_ex(apr_pool_t *pool,
200  const char *type,
201  const char *pathname,
202  const char **used1,
203  const char **used2);
204 
217 APU_DECLARE(void) apr_dbm_get_usednames(apr_pool_t *pool,
218  const char *pathname,
219  const char **used1,
220  const char **used2);
221 
223 #ifdef __cplusplus
224 }
225 #endif
226 
227 #endif /* !APR_DBM_H */