xref: /openbsd/include/icdb.h (revision 5af055cd)
1 /* $OpenBSD: icdb.h,v 1.2 2015/11/18 17:59:56 tedu Exp $ */
2 /*
3  * Copyright (c) 2015 Ted Unangst <tedu@openbsd.org>
4  *
5  * Permission to use, copy, modify, and distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  */
17 
18 
19 struct icdb;
20 
21 struct icdb *icdb_new(uint32_t version, uint32_t nentries, uint32_t entrysize,
22     uint32_t nkeys, uint32_t *keysizes, uint32_t *keyoffsets);
23 
24 struct icdb *icdb_open(const char *name, int flags, uint32_t version);
25 int icdb_get(struct icdb *db, void *entry, uint32_t idx);
26 int icdb_lookup(struct icdb *db, int keynum, const void *key, void *entry,
27     uint32_t *idxp);
28 int icdb_nentries(struct icdb *db);
29 const void *icdb_entries(struct icdb *db);
30 int icdb_update(struct icdb *db, const void *entry, int offset);
31 int icdb_add(struct icdb *db, const void *entry);
32 int icdb_rehash(struct icdb *db);
33 int icdb_save(struct icdb *db, int fd);
34 int icdb_close(struct icdb *db);
35