Apache Portable Runtime Utility Library
apr_sdbm.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 /*
18  * sdbm - ndbm work-alike hashed database library
19  * based on Per-Ake Larson's Dynamic Hashing algorithms. BIT 18 (1978).
20  * author: oz@nexus.yorku.ca
21  * status: ex-public domain
22  */
23 
24 #ifndef APR_SDBM_H
25 #define APR_SDBM_H
26 
27 #include "apu.h"
28 #include "apr_errno.h"
29 #include "apr_file_io.h" /* for apr_fileperms_t */
30 
44 typedef struct apr_sdbm_t apr_sdbm_t;
45 
49 typedef struct {
51  char *dptr;
53  /* apr_ssize_t for release 2.0??? */
54  int dsize;
56 
57 /* The extensions used for the database files */
59 #define APR_SDBM_DIRFEXT ".dir"
60 
61 #define APR_SDBM_PAGFEXT ".pag"
62 
63 /* flags to sdbm_store */
64 #define APR_SDBM_INSERT 0
65 #define APR_SDBM_REPLACE 1
66 #define APR_SDBM_INSERTDUP 2
86 APU_DECLARE(apr_status_t) apr_sdbm_open(apr_sdbm_t **db, const char *name,
87  apr_int32_t mode,
88  apr_fileperms_t perms, apr_pool_t *p);
89 
94 APU_DECLARE(apr_status_t) apr_sdbm_close(apr_sdbm_t *db);
95 
111 APU_DECLARE(apr_status_t) apr_sdbm_lock(apr_sdbm_t *db, int type);
112 
117 APU_DECLARE(apr_status_t) apr_sdbm_unlock(apr_sdbm_t *db);
118 
125 APU_DECLARE(apr_status_t) apr_sdbm_fetch(apr_sdbm_t *db,
126  apr_sdbm_datum_t *value,
127  apr_sdbm_datum_t key);
128 
140 APU_DECLARE(apr_status_t) apr_sdbm_store(apr_sdbm_t *db, apr_sdbm_datum_t key,
141  apr_sdbm_datum_t value, int opt);
142 
149 APU_DECLARE(apr_status_t) apr_sdbm_delete(apr_sdbm_t *db,
150  const apr_sdbm_datum_t key);
151 
161 APU_DECLARE(apr_status_t) apr_sdbm_firstkey(apr_sdbm_t *db, apr_sdbm_datum_t *key);
162 
168 APU_DECLARE(apr_status_t) apr_sdbm_nextkey(apr_sdbm_t *db, apr_sdbm_datum_t *key);
169 
174 APU_DECLARE(int) apr_sdbm_rdonly(apr_sdbm_t *db);
176 #endif /* APR_SDBM_H */
char * dptr
Definition: apr_sdbm.h:51
apr_status_t apr_sdbm_store(apr_sdbm_t *db, apr_sdbm_datum_t key, apr_sdbm_datum_t value, int opt)
int dsize
Definition: apr_sdbm.h:54
Definition: apr_sdbm.h:49
apr_status_t apr_sdbm_unlock(apr_sdbm_t *db)
apr_status_t apr_sdbm_lock(apr_sdbm_t *db, int type)
apr_status_t apr_sdbm_nextkey(apr_sdbm_t *db, apr_sdbm_datum_t *key)
apr_status_t apr_sdbm_delete(apr_sdbm_t *db, const apr_sdbm_datum_t key)
apr_status_t apr_sdbm_fetch(apr_sdbm_t *db, apr_sdbm_datum_t *value, apr_sdbm_datum_t key)
Definition: sdbm_private.h:49
apr_status_t apr_sdbm_close(apr_sdbm_t *db)
apr_status_t apr_sdbm_firstkey(apr_sdbm_t *db, apr_sdbm_datum_t *key)
int apr_sdbm_rdonly(apr_sdbm_t *db)