include/private/apr_dbm_private.h

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 #ifndef APR_DBM_PRIVATE_H
00018 #define APR_DBM_PRIVATE_H
00019 
00020 #include "apr.h"
00021 #include "apr_errno.h"
00022 #include "apr_pools.h"
00023 #include "apr_dbm.h"
00024 #include "apr_file_io.h"
00025 
00026 #include "apu.h"
00027 
00028 /* ### for now, include the DBM selection; this will go away once we start
00029    ### building and linking all of the DBMs at once. */
00030 #include "apu_select_dbm.h"
00031 
00032 #ifdef __cplusplus
00033 extern "C" {
00034 #endif
00035 
00042 APU_DECLARE(int) apr_posix_perms2mode(apr_fileperms_t perm);
00043 
00047 typedef struct {
00049     const char *name;
00050 
00052     apr_status_t (*open)(apr_dbm_t **pdb, const char *pathname,
00053                          apr_int32_t mode, apr_fileperms_t perm,
00054                          apr_pool_t *pool);
00055 
00057     void (*close)(apr_dbm_t *dbm);
00058 
00060     apr_status_t (*fetch)(apr_dbm_t *dbm, apr_datum_t key,
00061                                    apr_datum_t * pvalue);
00062 
00064     apr_status_t (*store)(apr_dbm_t *dbm, apr_datum_t key, apr_datum_t value);
00065 
00067     apr_status_t (*del)(apr_dbm_t *dbm, apr_datum_t key);
00068 
00070     int (*exists)(apr_dbm_t *dbm, apr_datum_t key);
00071 
00073     apr_status_t (*firstkey)(apr_dbm_t *dbm, apr_datum_t * pkey);
00074 
00076     apr_status_t (*nextkey)(apr_dbm_t *dbm, apr_datum_t * pkey);
00077 
00079     void (*freedatum)(apr_dbm_t *dbm, apr_datum_t data);
00080 
00082     void (*getusednames)(apr_pool_t *pool,
00083                          const char *pathname,
00084                          const char **used1,
00085                          const char **used2);
00086 
00087 } apr_dbm_type_t;
00088 
00089 
00093 struct apr_dbm_t
00094 { 
00096     apr_pool_t *pool;
00097 
00099     void *file;
00100 
00102     int errcode;
00104     const char *errmsg;
00105 
00107     const apr_dbm_type_t *type;
00108 };
00109 
00110 
00111 /* Declare all of the builtin DBM providers */
00112 APU_DECLARE_DATA extern const apr_dbm_type_t apr_dbm_type_sdbm;
00113 APU_DECLARE_DATA extern const apr_dbm_type_t apr_dbm_type_gdbm;
00114 APU_DECLARE_DATA extern const apr_dbm_type_t apr_dbm_type_ndbm;
00115 APU_DECLARE_DATA extern const apr_dbm_type_t apr_dbm_type_db1;
00116 APU_DECLARE_DATA extern const apr_dbm_type_t apr_dbm_type_db2;
00117 APU_DECLARE_DATA extern const apr_dbm_type_t apr_dbm_type_db3;
00118 APU_DECLARE_DATA extern const apr_dbm_type_t apr_dbm_type_db4;
00119 APU_DECLARE_DATA extern const apr_dbm_type_t apr_dbm_type_db;
00120 
00121 #ifdef __cplusplus
00122 }
00123 #endif
00124 
00125 #endif /* APR_DBM_PRIVATE_H */

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