Source code pulled from OpenBSD for OpenNTPD. The place to contribute to this code is via the OpenBSD CVS tree.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.5 KiB

  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. struct icdb;
  18. struct icdb *icdb_new(uint32_t version, uint32_t nentries, uint32_t entrysize,
  19. uint32_t nkeys, uint32_t *keysizes, uint32_t *keyoffsets);
  20. struct icdb *icdb_open(const char *name, int flags, uint32_t version);
  21. int icdb_get(struct icdb *db, void *entry, uint32_t idx);
  22. int icdb_lookup(struct icdb *db, int keynum, const void *key, void *entry,
  23. uint32_t *idxp);
  24. int icdb_nentries(struct icdb *db);
  25. const void *icdb_entries(struct icdb *db);
  26. int icdb_update(struct icdb *db, const void *entry, int offset);
  27. int icdb_add(struct icdb *db, const void *entry);
  28. int icdb_rehash(struct icdb *db);
  29. int icdb_save(struct icdb *db, int fd);
  30. int icdb_close(struct icdb *db);