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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef APR_DBM_PRIVATE_H
18 #define APR_DBM_PRIVATE_H
21 #include "apr_errno.h"
22 #include "apr_pools.h"
24 #include "apr_file_io.h"
28 /* ### for now, include the DBM selection; this will go away once we start
29 ### building and linking all of the DBMs at once. */
30 #include "apu_select_dbm.h"
39 * Most DBM libraries take a POSIX mode for creating files. Don't trust
40 * the mode_t type, some platforms may not support it, int is safe.
42 APU_DECLARE(int) apr_posix_perms2mode(apr_fileperms_t perm);
45 * Structure to describe the operations of the DBM
48 /** The name of the DBM Type */
52 apr_status_t (*open)(apr_dbm_t **pdb, const char *pathname,
53 apr_int32_t mode, apr_fileperms_t perm,
57 void (*close)(apr_dbm_t *dbm);
59 /** Fetch a dbm record value by key */
60 apr_status_t (*fetch)(apr_dbm_t *dbm, apr_datum_t key,
61 apr_datum_t * pvalue);
63 /** Store a dbm record value by key */
64 apr_status_t (*store)(apr_dbm_t *dbm, apr_datum_t key, apr_datum_t value);
66 /** Delete a dbm record value by key */
67 apr_status_t (*del)(apr_dbm_t *dbm, apr_datum_t key);
69 /** Search for a key within the dbm */
70 int (*exists)(apr_dbm_t *dbm, apr_datum_t key);
72 /** Retrieve the first record key from a dbm */
73 apr_status_t (*firstkey)(apr_dbm_t *dbm, apr_datum_t * pkey);
75 /** Retrieve the next record key from a dbm */
76 apr_status_t (*nextkey)(apr_dbm_t *dbm, apr_datum_t * pkey);
78 /** Proactively toss any memory associated with the apr_datum_t. */
79 void (*freedatum)(apr_dbm_t *dbm, apr_datum_t data);
81 /** Get the names that the DBM will use for a given pathname. */
82 void (*getusednames)(apr_pool_t *pool,
95 /** Associated pool */
98 /** pointer to DB Implementation Specific data */
101 /** Current integer error code */
103 /** Current string error code */
106 /** the type of DBM */
107 const apr_dbm_type_t *type;
111 /* Declare all of the DBM provider tables */
112 APU_MODULE_DECLARE_DATA extern const apr_dbm_type_t apr_dbm_type_sdbm;
113 APU_MODULE_DECLARE_DATA extern const apr_dbm_type_t apr_dbm_type_gdbm;
114 APU_MODULE_DECLARE_DATA extern const apr_dbm_type_t apr_dbm_type_ndbm;
115 APU_MODULE_DECLARE_DATA extern const apr_dbm_type_t apr_dbm_type_db;
121 #endif /* APR_DBM_PRIVATE_H */