include/apr_sdbm.h

Go to the documentation of this file.
00001 /* Copyright 2000-2005 The Apache Software Foundation or its licensors, as
00002  * applicable.
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 /*
00018  * sdbm - ndbm work-alike hashed database library
00019  * based on Per-Ake Larson's Dynamic Hashing algorithms. BIT 18 (1978).
00020  * author: oz@nexus.yorku.ca
00021  * status: ex-public domain
00022  */
00023 
00024 #ifndef APR_SDBM_H
00025 #define APR_SDBM_H
00026 
00027 #include "apu.h"
00028 #include "apr_errno.h"
00029 #include "apr_file_io.h"   /* for apr_fileperms_t */
00030 
00044 typedef struct apr_sdbm_t apr_sdbm_t;
00045 
00049 typedef struct {
00051     char *dptr;
00053     int dsize;
00054 } apr_sdbm_datum_t;
00055 
00056 /* The extensions used for the database files */
00058 #define APR_SDBM_DIRFEXT        ".dir"
00059 
00060 #define APR_SDBM_PAGFEXT        ".pag"
00061 
00062 /* flags to sdbm_store */
00063 #define APR_SDBM_INSERT     0   
00064 #define APR_SDBM_REPLACE    1   
00065 #define APR_SDBM_INSERTDUP  2   
00085 APU_DECLARE(apr_status_t) apr_sdbm_open(apr_sdbm_t **db, const char *name, 
00086                                         apr_int32_t mode, 
00087                                         apr_fileperms_t perms, apr_pool_t *p);
00088 
00093 APU_DECLARE(apr_status_t) apr_sdbm_close(apr_sdbm_t *db);
00094 
00110 APU_DECLARE(apr_status_t) apr_sdbm_lock(apr_sdbm_t *db, int type);
00111 
00116 APU_DECLARE(apr_status_t) apr_sdbm_unlock(apr_sdbm_t *db);
00117 
00124 APU_DECLARE(apr_status_t) apr_sdbm_fetch(apr_sdbm_t *db, 
00125                                          apr_sdbm_datum_t *value, 
00126                                          apr_sdbm_datum_t key);
00127 
00139 APU_DECLARE(apr_status_t) apr_sdbm_store(apr_sdbm_t *db, apr_sdbm_datum_t key,
00140                                          apr_sdbm_datum_t value, int opt);
00141 
00148 APU_DECLARE(apr_status_t) apr_sdbm_delete(apr_sdbm_t *db, 
00149                                           const apr_sdbm_datum_t key);
00150 
00160 APU_DECLARE(apr_status_t) apr_sdbm_firstkey(apr_sdbm_t *db, apr_sdbm_datum_t *key);
00161 
00167 APU_DECLARE(apr_status_t) apr_sdbm_nextkey(apr_sdbm_t *db, apr_sdbm_datum_t *key);
00168 
00173 APU_DECLARE(int) apr_sdbm_rdonly(apr_sdbm_t *db);
00175 #endif /* APR_SDBM_H */

Generated on Tue Sep 11 08:13:14 2007 for Apache Portable Runtime Utility Library by  doxygen 1.5.2