/* automatically generated by rust-bindgen and modified by hand */

pub enum MDB_env { }
pub enum MDB_txn { }
pub type MDB_dbi = ::libc::c_uint;
pub enum MDB_cursor { }

#[repr(C)]
pub struct MDB_val {
    pub mv_size: ::libc::size_t,
    pub mv_data: *mut ::libc::c_void,
}

pub type MDB_cmp_func = extern "C" fn(a: *const MDB_val, b: *const MDB_val) -> ::libc::c_int;
pub type MDB_rel_func = extern "C" fn (item: *mut MDB_val, oldptr: *mut ::libc::c_void, newptr: *mut ::libc::c_void, relctx: *mut ::libc::c_void) -> ();

pub const MDB_FIRST: ::libc::c_uint = 0;
pub const MDB_FIRST_DUP: ::libc::c_uint = 1;
pub const MDB_GET_BOTH: ::libc::c_uint = 2;
pub const MDB_GET_BOTH_RANGE: ::libc::c_uint = 3;
pub const MDB_GET_CURRENT: ::libc::c_uint = 4;
pub const MDB_GET_MULTIPLE: ::libc::c_uint = 5;
pub const MDB_LAST: ::libc::c_uint = 6;
pub const MDB_LAST_DUP: ::libc::c_uint = 7;
pub const MDB_NEXT: ::libc::c_uint = 8;
pub const MDB_NEXT_DUP: ::libc::c_uint = 9;
pub const MDB_NEXT_MULTIPLE: ::libc::c_uint = 10;
pub const MDB_NEXT_NODUP: ::libc::c_uint = 11;
pub const MDB_PREV: ::libc::c_uint = 12;
pub const MDB_PREV_DUP: ::libc::c_uint = 13;
pub const MDB_PREV_NODUP: ::libc::c_uint = 14;
pub const MDB_SET: ::libc::c_uint = 15;
pub const MDB_SET_KEY: ::libc::c_uint = 16;
pub const MDB_SET_RANGE: ::libc::c_uint = 17;
pub type MDB_cursor_op = ::libc::c_uint;

#[repr(C)]
#[derive(Clone, Copy)]
pub struct MDB_stat {
    pub ms_psize: ::libc::c_uint,
    pub ms_depth: ::libc::c_uint,
    pub ms_branch_pages: ::libc::size_t,
    pub ms_leaf_pages: ::libc::size_t,
    pub ms_overflow_pages: ::libc::size_t,
    pub ms_entries: ::libc::size_t,
}

#[repr(C)]
pub struct MDB_envinfo {
    pub me_mapaddr: *mut ::libc::c_void,
    pub me_mapsize: ::libc::size_t,
    pub me_last_pgno: ::libc::size_t,
    pub me_last_txnid: ::libc::size_t,
    pub me_maxreaders: ::libc::c_uint,
    pub me_numreaders: ::libc::c_uint,
}

pub type MDB_assert_func = extern "C" fn(env: *mut MDB_env, msg: *const ::libc::c_char) -> ();
pub type MDB_msg_func = extern "C" fn(msg: *const ::libc::c_char, ctx: *mut ::libc::c_void) -> ::libc::c_int;

extern "C" {
    pub fn mdb_version(major: *mut ::libc::c_int, minor: *mut ::libc::c_int, patch: *mut ::libc::c_int) -> *mut ::libc::c_char;
    pub fn mdb_strerror(err: ::libc::c_int) -> *mut ::libc::c_char;
    pub fn mdb_env_create(env: *mut *mut MDB_env) -> ::libc::c_int;
    pub fn mdb_env_open(env: *mut MDB_env, path: *const ::libc::c_char, flags: ::libc::c_uint, mode: super::mode_t) -> ::libc::c_int;
    pub fn mdb_env_copy(env: *mut MDB_env, path: *const ::libc::c_char) -> ::libc::c_int;
    pub fn mdb_env_copyfd(env: *mut MDB_env, fd: ::libc::c_int) -> ::libc::c_int;
    pub fn mdb_env_copy2(env: *mut MDB_env, path: *const ::libc::c_char, flags: ::libc::c_uint) -> ::libc::c_int;
    pub fn mdb_env_copyfd2(env: *mut MDB_env, fd: ::libc::c_int, flags: ::libc::c_uint) -> ::libc::c_int;
    pub fn mdb_env_stat(env: *mut MDB_env, stat: *mut MDB_stat) -> ::libc::c_int;
    pub fn mdb_env_info(env: *mut MDB_env, stat: *mut MDB_envinfo) -> ::libc::c_int;
    pub fn mdb_env_sync(env: *mut MDB_env, force: ::libc::c_int) -> ::libc::c_int;
    pub fn mdb_env_close(env: *mut MDB_env) -> ();
    pub fn mdb_env_set_flags(env: *mut MDB_env, flags: ::libc::c_uint, onoff: ::libc::c_int) -> ::libc::c_int;
    pub fn mdb_env_get_flags(env: *mut MDB_env, flags: *mut ::libc::c_uint) -> ::libc::c_int;
    pub fn mdb_env_get_path(env: *mut MDB_env, path: *mut *const ::libc::c_char) -> ::libc::c_int;
    pub fn mdb_env_get_fd(env: *mut MDB_env, fd: *mut ::libc::c_int) -> ::libc::c_int;
    pub fn mdb_env_set_mapsize(env: *mut MDB_env, size: ::libc::size_t) -> ::libc::c_int;
    pub fn mdb_env_set_maxreaders(env: *mut MDB_env, readers: ::libc::c_uint) -> ::libc::c_int;
    pub fn mdb_env_get_maxreaders(env: *mut MDB_env, readers: *mut ::libc::c_uint) -> ::libc::c_int;
    pub fn mdb_env_set_maxdbs(env: *mut MDB_env, dbs: MDB_dbi) -> ::libc::c_int;
    pub fn mdb_env_get_maxkeysize(env: *mut MDB_env) -> ::libc::c_int;
    pub fn mdb_env_set_userctx(env: *mut MDB_env, ctx: *mut ::libc::c_void) -> ::libc::c_int;
    pub fn mdb_env_get_userctx(env: *mut MDB_env) -> *mut ::libc::c_void;
    pub fn mdb_env_set_assert(env: *mut MDB_env, func: *mut ::std::option::Option<extern "C" fn() -> ()>) -> ::libc::c_int;
    pub fn mdb_txn_begin(env: *mut MDB_env, parent: *mut MDB_txn, flags: ::libc::c_uint, txn: *mut *mut MDB_txn) -> ::libc::c_int;
    pub fn mdb_txn_env(txn: *mut MDB_txn) -> *mut MDB_env;
    pub fn mdb_txn_id(txn: *mut MDB_txn) -> ::libc::size_t;
    pub fn mdb_txn_commit(txn: *mut MDB_txn) -> ::libc::c_int;
    pub fn mdb_txn_abort(txn: *mut MDB_txn) -> ();
    pub fn mdb_txn_reset(txn: *mut MDB_txn) -> ();
    pub fn mdb_txn_renew(txn: *mut MDB_txn) -> ::libc::c_int;
    pub fn mdb_dbi_open(txn: *mut MDB_txn, name: *const ::libc::c_char, flags: ::libc::c_uint, dbi: *mut MDB_dbi) -> ::libc::c_int;
    pub fn mdb_stat(txn: *mut MDB_txn, dbi: MDB_dbi, stat: *mut MDB_stat) -> ::libc::c_int;
    pub fn mdb_dbi_flags(txn: *mut MDB_txn, dbi: MDB_dbi, flags: *mut ::libc::c_uint) -> ::libc::c_int;
    pub fn mdb_dbi_close(env: *mut MDB_env, dbi: MDB_dbi) -> ();
    pub fn mdb_drop(txn: *mut MDB_txn, dbi: MDB_dbi, del: ::libc::c_int) -> ::libc::c_int;
    pub fn mdb_set_compare(txn: *mut MDB_txn, dbi: MDB_dbi, cmp: *mut MDB_cmp_func) -> ::libc::c_int;
    pub fn mdb_set_dupsort(txn: *mut MDB_txn, dbi: MDB_dbi, cmp: *mut MDB_cmp_func) -> ::libc::c_int;
    pub fn mdb_set_relfunc(txn: *mut MDB_txn, dbi: MDB_dbi, rel: *mut MDB_rel_func) -> ::libc::c_int;
    pub fn mdb_set_relctx(txn: *mut MDB_txn, dbi: MDB_dbi, ctx: *mut ::libc::c_void) -> ::libc::c_int;
    pub fn mdb_get(txn: *mut MDB_txn, dbi: MDB_dbi, key: *mut MDB_val, data: *mut MDB_val) -> ::libc::c_int;
    pub fn mdb_put(txn: *mut MDB_txn, dbi: MDB_dbi, key: *mut MDB_val, data: *mut MDB_val, flags: ::libc::c_uint) -> ::libc::c_int;
    pub fn mdb_del(txn: *mut MDB_txn, dbi: MDB_dbi, key: *mut MDB_val, data: *mut MDB_val) -> ::libc::c_int;
    pub fn mdb_cursor_open(txn: *mut MDB_txn, dbi: MDB_dbi, cursor: *mut *mut MDB_cursor) -> ::libc::c_int;
    pub fn mdb_cursor_close(cursor: *mut MDB_cursor) -> ();
    pub fn mdb_cursor_renew(txn: *mut MDB_txn, cursor: *mut MDB_cursor) -> ::libc::c_int;
    pub fn mdb_cursor_txn(cursor: *mut MDB_cursor) -> *mut MDB_txn;
    pub fn mdb_cursor_dbi(cursor: *mut MDB_cursor) -> MDB_dbi;
    pub fn mdb_cursor_get(cursor: *mut MDB_cursor, key: *mut MDB_val, data: *mut MDB_val, op: MDB_cursor_op) -> ::libc::c_int;
    pub fn mdb_cursor_put(cursor: *mut MDB_cursor, key: *mut MDB_val, data: *mut MDB_val, flags: ::libc::c_uint) -> ::libc::c_int;
    pub fn mdb_cursor_del(cursor: *mut MDB_cursor, flags: ::libc::c_uint) -> ::libc::c_int;
    pub fn mdb_cursor_count(cursor: *mut MDB_cursor, countp: *mut ::libc::size_t) -> ::libc::c_int;
    pub fn mdb_cmp(txn: *mut MDB_txn, dbi: MDB_dbi, a: *const MDB_val, b: *const MDB_val) -> ::libc::c_int;
    pub fn mdb_dcmp(txn: *mut MDB_txn, dbi: MDB_dbi, a: *const MDB_val, b: *const MDB_val) -> ::libc::c_int;
    pub fn mdb_reader_list(env: *mut MDB_env, func: *mut MDB_msg_func, ctx: *mut ::libc::c_void) -> ::libc::c_int;
    pub fn mdb_reader_check(env: *mut MDB_env, dead: *mut ::libc::c_int) -> ::libc::c_int;
}
