-/** The tdb error codes */
-enum TDB1_ERROR {TDB1_SUCCESS=0, TDB1_ERR_CORRUPT, TDB1_ERR_IO, TDB1_ERR_LOCK,
- TDB1_ERR_OOM, TDB1_ERR_EXISTS, TDB1_ERR_NOLOCK, TDB1_ERR_LOCK_TIMEOUT,
- TDB1_ERR_NOEXIST, TDB1_ERR_EINVAL, TDB1_ERR_RDONLY,
- TDB1_ERR_NESTING};
-
-/** Debugging uses one of the following levels */
-enum tdb1_debug_level {TDB1_DEBUG_FATAL = 0, TDB1_DEBUG_ERROR,
- TDB1_DEBUG_WARNING, TDB1_DEBUG_TRACE};
-
-/** The tdb data structure */
-typedef struct TDB1_DATA {
- unsigned char *dptr;
- size_t dsize;
-} TDB1_DATA;
-
-#ifndef PRINTF_ATTRIBUTE
-#if (__GNUC__ >= 3)
-/** Use gcc attribute to check printf fns. a1 is the 1-based index of
- * the parameter containing the format, and a2 the index of the first
- * argument. Note that some gcc 2.x versions don't handle this
- * properly **/
-#define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format (__printf__, a1, a2)))
-#else
-#define PRINTF_ATTRIBUTE(a1, a2)
-#endif
-#endif
-
-/** This is the context structure that is returned from a db open. */
-typedef struct tdb1_context TDB1_CONTEXT;
-
-typedef int (*tdb1_traverse_func)(struct tdb1_context *, TDB1_DATA, TDB1_DATA, void *);
-typedef void (*tdb1_log_func)(struct tdb1_context *, enum tdb1_debug_level, const char *, ...) PRINTF_ATTRIBUTE(3, 4);
-typedef unsigned int (*tdb1_hash_func)(TDB1_DATA *key);
-
-struct tdb1_logging_context {
- tdb1_log_func log_fn;
- void *log_private;
-};
-
-struct tdb1_context *tdb1_open(const char *name, int hash_size, int tdb1_flags,
- int open_flags, mode_t mode);
-
-struct tdb1_context *tdb1_open_ex(const char *name, int hash_size, int tdb1_flags,
- int open_flags, mode_t mode,
- const struct tdb1_logging_context *log_ctx,
- tdb1_hash_func hash_fn);
-
-void tdb1_set_max_dead(struct tdb1_context *tdb, int max_dead);
-
-int tdb1_reopen(struct tdb1_context *tdb);
-
-int tdb1_reopen_all(int parent_longlived);
-
-void tdb1_set_logging_function(struct tdb1_context *tdb, const struct tdb1_logging_context *log_ctx);
-
-enum TDB1_ERROR tdb1_error(struct tdb1_context *tdb);
-
-const char *tdb1_errorstr(struct tdb1_context *tdb);
-
-TDB1_DATA tdb1_fetch(struct tdb1_context *tdb, TDB1_DATA key);
-
-int tdb1_parse_record(struct tdb1_context *tdb, TDB1_DATA key,
- int (*parser)(TDB1_DATA key, TDB1_DATA data,
- void *private_data),
- void *private_data);
-
-int tdb1_delete(struct tdb1_context *tdb, TDB1_DATA key);
-
-int tdb1_store(struct tdb1_context *tdb, TDB1_DATA key, TDB1_DATA dbuf, int flag);
-
-int tdb1_append(struct tdb1_context *tdb, TDB1_DATA key, TDB1_DATA new_dbuf);
-
-int tdb1_close(struct tdb1_context *tdb);
-
-TDB1_DATA tdb1_firstkey(struct tdb1_context *tdb);
-
-TDB1_DATA tdb1_nextkey(struct tdb1_context *tdb, TDB1_DATA key);
-
-int tdb1_traverse(struct tdb1_context *tdb, tdb1_traverse_func fn, void *private_data);
-
-int tdb1_traverse_read(struct tdb1_context *tdb, tdb1_traverse_func fn, void *private_data);
-
-int tdb1_exists(struct tdb1_context *tdb, TDB1_DATA key);
-
-int tdb1_lockall(struct tdb1_context *tdb);
-
-int tdb1_lockall_nonblock(struct tdb1_context *tdb);
-
-int tdb1_unlockall(struct tdb1_context *tdb);
-
-int tdb1_lockall_read(struct tdb1_context *tdb);
-
-int tdb1_lockall_read_nonblock(struct tdb1_context *tdb);
-
-int tdb1_unlockall_read(struct tdb1_context *tdb);
-
-int tdb1_lockall_mark(struct tdb1_context *tdb);
-
-int tdb1_lockall_unmark(struct tdb1_context *tdb);
-
-const char *tdb1_name(struct tdb1_context *tdb);
-
-int tdb1_fd(struct tdb1_context *tdb);
-
-tdb1_log_func tdb1_log_fn(struct tdb1_context *tdb);
-
-void *tdb1_get_logging_private(struct tdb1_context *tdb);
-
-int tdb1_transaction_start(struct tdb1_context *tdb);
-
-int tdb1_transaction_start_nonblock(struct tdb1_context *tdb);
-
-int tdb1_transaction_prepare_commit(struct tdb1_context *tdb);
-
-int tdb1_transaction_commit(struct tdb1_context *tdb);
-
-int tdb1_transaction_cancel(struct tdb1_context *tdb);
-
-int tdb1_get_seqnum(struct tdb1_context *tdb);
-
-int tdb1_hash_size(struct tdb1_context *tdb);
-
-size_t tdb1_map_size(struct tdb1_context *tdb);
-
-int tdb1_get_flags(struct tdb1_context *tdb);
-
-void tdb1_add_flags(struct tdb1_context *tdb, unsigned flag);
-
-void tdb1_remove_flags(struct tdb1_context *tdb, unsigned flag);
-
-void tdb1_enable_seqnum(struct tdb1_context *tdb);
-
-void tdb1_increment_seqnum_nonblock(struct tdb1_context *tdb);
-
-unsigned int tdb1_jenkins_hash(TDB1_DATA *key);
-
-int tdb1_check(struct tdb1_context *tdb,
- int (*check) (TDB1_DATA key, TDB1_DATA data, void *private_data),
- void *private_data);