/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1996, 1997, 1998
* Sleepycat Software. All rights reserved.
*
* @(#)db.h 10.174 (Sleepycat) 1/3/99
*/
#ifndef _DB_H_
#define _DB_H_
#ifndef __NO_SYSTEM_INCLUDES
#include <stdio.h>
#endif
/*
* XXX
* MacOS: ensure that Metrowerks C makes enumeration types int sized.
*/
#ifdef __MWERKS__
#pragma enumsalwaysint on
#endif
/*
* XXX
* Handle function prototypes and the keyword "const". This steps on name
* space that DB doesn't control, but all of the other solutions are worse.
*
* XXX
* While Microsoft's compiler is ANSI C compliant, it doesn't have _STDC_
* defined by default, you specify a command line flag or #pragma to turn
* it on. Don't do that, however, because some of Microsoft's own header
* files won't compile.
*/
#else
#define const
#endif
/*
* !!!
* DB needs basic information about specifically sized types. If they're
* not provided by the system, typedef them here.
*
* We protect them against multiple inclusion using __BIT_TYPES_DEFINED__,
* as does BIND and Kerberos, since we don't know for sure what #include
* files the user is using.
*
* !!!
* We also provide the standard u_int, u_long etc., if they're not provided
* by the system.
*/
#ifndef __BIT_TYPES_DEFINED__
#define __BIT_TYPES_DEFINED__
typedef unsigned char u_int8_t;
typedef unsigned short u_int16_t;
typedef unsigned int u_int32_t;
#endif
/* Forward structure declarations, so applications get type checking. */
#ifdef DB_DBM_HSEARCH
#endif
struct __db_dbt {
};
/*
* DB run-time interface configuration.
*
* There are a set of functions that the application can replace with its
* own versions, and some other knobs which can be turned at run-time.
*/
/*
* Database configuration and initialization.
*/
/*
* Flags understood by both db_open(3) and db_appinit(3).
*/
/*
* Flags understood by db_appinit(3).
*/
/* 0x000007 COMMON MASK. */
/*
* Flags understood by db_open(3).
*
* DB_EXCL and DB_TEMPORARY are internal only, and are not documented.
* DB_SEQUENTIAL is currently internal, but may be exported some day.
*/
/* 0x000007 COMMON MASK. */
/* 0x001fff ALREADY USED. */
/*
* Deadlock detector modes; used in the DBENV structure to configure the
* locking subsystem.
*/
#define DB_LOCK_NORUN 0
struct __db_env {
/* Error message callback. */
/* User paths. */
/* Locking. */
/* Logging. */
/* Memory pool. */
/* Transactions. */
/*
* XA support.
*
* !!!
* Explicit representations of structures in queue.h.
*
* TAILQ_ENTRY(__db_env);
*/
struct {
} links;
};
/*******************************************************
* Access methods.
*******************************************************/
/*
* !!!
*/
typedef enum {
} DBTYPE;
struct __db_info {
/* Local heap allocation. */
/* Btree access method. */
/* Hash access method. */
/* Recno access method. */
};
/*
* DB access method and cursor operation values. Each value is an operation
* code to which additional bit flags are added.
*/
/*
* DB (user visible) error return codes.
*
* !!!
* Changes to any of the user visible error return codes must be reflected
*/
was never created by the user. */
/* DB (private) error return codes. */
/* DB access method description structure. */
struct __db {
/* Documented, returned information. */
/*
* !!!
* Explicit representations of structures in queue.h.
*
* TAILQ_HEAD(free_queue, __dbc);
* TAILQ_HEAD(active_queue, __dbc);
*/
struct {
} free_queue;
struct {
} active_queue;
locking. */
/* Local heap allocation. */
/* Functions. */
};
};
/* Cursor description structure. */
struct __dbc {
/*
* !!!
* Explicit representations of structures in queue.h.
*
* TAILQ_ENTRY(__dbc);
*/
struct {
} links;
};
struct __db_bt_stat {
};
/* Hash statistics structure. */
struct __db_h_stat {
};
#if defined(__cplusplus)
extern "C" {
#endif
int db_jump_set __P((void *, int));
int db_value_set __P((int, int));
char *db_version __P((int *, int *, int *));
int db_xa_open __P((const char *,
#if defined(__cplusplus)
}
#endif
/*******************************************************
* Locking
*******************************************************/
/* Flag values for lock_vec(), lock_get(). */
of granting a new one (internal). */
/* Flag values for lock_detect(). */
/*
* Request types.
*
* !!!
*/
typedef enum {
} db_lockop_t;
/*
* Simple R/W lock modes and for multi-granularity intention locking.
*
* !!!
* These values are NOT random, as they are used as an index into the lock
* conflicts arrays, i.e., DB_LOCK_IWRITE must be == 3, and DB_LOCK_IREAD
* must be == 4.
*
* !!!
*/
typedef enum {
/*
* Status of a lock.
*/
typedef enum {
* promoted; waiting for the owner
* to run and upgrade it to held. */
} db_status_t;
/* Lock request structure. */
struct __db_lockreq {
};
/*
* Commonly used conflict matrices.
*
*/
extern const u_int8_t db_rw_conflicts[];
/* Multi-granularity locking. */
extern const u_int8_t db_riw_conflicts[];
struct __db_lock_stat {
};
#if defined(__cplusplus)
extern "C" {
#endif
#if defined(__cplusplus)
}
#endif
/*******************************************************
* Logging.
*******************************************************/
/* Flag values for log_archive(). */
/*
* A DB_LSN has two parts, a fileid which identifies a specific file, and an
* offset within that file. The fileid is an unsigned 4-byte quantity that
* uniquely identifies a file within the log directory -- currently a simple
* counter inside the log. The offset is also an unsigned 4-byte value. The
* log manager guarantees the offset is never more than 4 bytes by switching
* to a new log file before the maximum length imposed by an unsigned 4-byte
* offset is reached.
*/
struct __db_lsn {
};
/* Log statistics structure. */
struct __db_log_stat {
};
#if defined(__cplusplus)
extern "C" {
#endif
#if defined(__cplusplus)
}
#endif
/*******************************************************
* Mpool
*******************************************************/
/* Flag values for memp_fget(). */
/* Flag values for memp_fput(), memp_fset(). */
/* Mpool statistics structure. */
struct __db_mpool_stat {
};
/* Mpool file open information structure. */
struct __db_mpool_finfo {
};
/* Mpool file statistics structure. */
struct __db_mpool_fstat {
};
#if defined(__cplusplus)
extern "C" {
#endif
#if defined(__cplusplus)
}
#endif
/*******************************************************
* Transactions.
*******************************************************/
/* Operations values to the tx_recover() function. */
/* Internal transaction status values. */
/* Transaction statistics structure. */
struct __db_txn_active {
};
struct __db_txn_stat {
};
#if defined(__cplusplus)
extern "C" {
#endif
#if defined(__cplusplus)
}
#endif
#ifndef DB_DBM_HSEARCH
#endif
#if DB_DBM_HSEARCH != 0
/*******************************************************
*******************************************************/
/*
* The db(3) support for ndbm(3) always appends this suffix to the
* file name to avoid overwriting the user's original database.
*/
typedef struct {
void *dptr;
} datum;
/*
* Translate DBM calls into DB calls so that DB doesn't step on the
* application's name space.
*
* The global variables dbrdonly, dirf and pagf were not retained when
* 4BSD replaced the dbm interface with ndbm, and are not support here.
*/
#if !defined(__cplusplus)
#endif
/* Prototype the DB calls. */
#if defined(__cplusplus)
extern "C" {
#endif
int __db_dbm_close __P((void));
int __db_dbm_dbrdonly __P((void));
int __db_dbm_dirf __P((void));
int __db_dbm_init __P((char *));
int __db_dbm_pagf __P((void));
#if defined(__cplusplus)
}
#endif
/*
* Translate NDBM calls into DB calls so that DB doesn't step on the
* application's name space.
*/
/* Prototype the DB calls. */
#if defined(__cplusplus)
extern "C" {
#endif
#if defined(__cplusplus)
}
#endif
/*******************************************************
* Hsearch historic interface.
*******************************************************/
typedef enum {
} ACTION;
typedef struct entry {
char *key;
char *data;
} ENTRY;
/*
* Translate HSEARCH calls into DB calls so that DB doesn't step on the
* application's name space.
*/
/* Prototype the DB calls. */
#if defined(__cplusplus)
extern "C" {
#endif
void __db_hdestroy __P((void));
#if defined(__cplusplus)
}
#endif
#endif /* DB_DBM_HSEARCH */
/*
* XXX
* MacOS: Reset Metrowerks C enum sizes.
*/
#ifdef __MWERKS__
#pragma enumsalwaysint reset
#endif
#endif /* !_DB_H_ */