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
44typedef struct apr_sdbm_t apr_sdbm_t;
45
49typedef 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"
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
86APU_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
94APU_DECLARE(apr_status_t) apr_sdbm_close(apr_sdbm_t *db);
95
111APU_DECLARE(apr_status_t) apr_sdbm_lock(apr_sdbm_t *db, int type);
112
117APU_DECLARE(apr_status_t) apr_sdbm_unlock(apr_sdbm_t *db);
118
125APU_DECLARE(apr_status_t) apr_sdbm_fetch(apr_sdbm_t *db,
126 apr_sdbm_datum_t *value,
127 apr_sdbm_datum_t key);
128
140APU_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
149APU_DECLARE(apr_status_t) apr_sdbm_delete(apr_sdbm_t *db,
150 const apr_sdbm_datum_t key);
151
161APU_DECLARE(apr_status_t) apr_sdbm_firstkey(apr_sdbm_t *db, apr_sdbm_datum_t *key);
162
168APU_DECLARE(apr_status_t) apr_sdbm_nextkey(apr_sdbm_t *db, apr_sdbm_datum_t *key);
169
174APU_DECLARE(int) apr_sdbm_rdonly(apr_sdbm_t *db);
176#endif /* APR_SDBM_H */
apr_status_t apr_sdbm_open(apr_sdbm_t **db, const char *name, apr_int32_t mode, apr_fileperms_t perms, apr_pool_t *p)
apr_status_t apr_sdbm_lock(apr_sdbm_t *db, int type)
apr_status_t apr_sdbm_delete(apr_sdbm_t *db, const apr_sdbm_datum_t key)
apr_status_t apr_sdbm_nextkey(apr_sdbm_t *db, 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)
apr_status_t apr_sdbm_unlock(apr_sdbm_t *db)
int apr_sdbm_rdonly(apr_sdbm_t *db)
apr_status_t apr_sdbm_store(apr_sdbm_t *db, apr_sdbm_datum_t key, apr_sdbm_datum_t value, int opt)
apr_status_t apr_sdbm_firstkey(apr_sdbm_t *db, apr_sdbm_datum_t *key)
struct apr_sdbm_t apr_sdbm_t
Definition: apr_sdbm.h:44
apr_status_t apr_sdbm_close(apr_sdbm_t *db)
Definition: apr_sdbm.h:49
char * dptr
Definition: apr_sdbm.h:51
int dsize
Definition: apr_sdbm.h:54