nsdbmgmt.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /** BEGIN COPYRIGHT BLOCK
  2. * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
  3. * Copyright (C) 2005 Red Hat, Inc.
  4. * All rights reserved.
  5. * END COPYRIGHT BLOCK **/
  6. #ifndef __nsdbmgmt_h
  7. #define __nsdbmgmt_h
  8. /*
  9. * Description (nsdbmgmt.h)
  10. *
  11. * The file describes the interface for managing information in
  12. * a Netscape (server) database. A database is composed of
  13. * two (libdbm) DB files. One of these (<dbname>.db) contains
  14. * records indexed by a string key. These records contain the
  15. * primary information in the database. A second DB file
  16. * (<dbname>.id) is used to map an integer id value to a string
  17. * key, which can then be used to locate a record in the first file.
  18. * The interface for retrieving information from a database is
  19. * described in nsdb.h.
  20. *
  21. * FUTURE:
  22. * Normally the records in the primary DB file will contain the
  23. * id values which are used to key the id-to-name DB. When this
  24. * is the case, it is possible to construct the id-to-name DB from
  25. * the primary DB file, and an interface is provided to facilitate
  26. * this.
  27. */
  28. #include "nsdb.h" /* database access */
  29. /* Define flags for ndbStoreName() */
  30. #define NDBF_NEWNAME 0x1 /* this is (should be) a new name */
  31. NSPR_BEGIN_EXTERN_C
  32. /* Functions for database management in nsdbmgmt.c */
  33. extern int ndbAllocId(NSErr_t * errp, void * ndb,
  34. int namelen, char * name, unsigned int * id);
  35. extern int ndbDeleteName(NSErr_t * errp,
  36. void * ndb, int flags, int namelen, char * name);
  37. extern int ndbFreeId(NSErr_t * errp,
  38. void * ndb, int namelen, char * name, unsigned int id);
  39. extern int ndbRenameId(NSErr_t * errp, void * ndb,
  40. int namelen, char * newname, unsigned int id);
  41. extern int ndbStoreName(NSErr_t * errp, void * ndb, int flags,
  42. int namelen, char * name, int reclen, char * recptr);
  43. extern int ndbSync(NSErr_t * errp, void * ndb, int flags);
  44. NSPR_END_EXTERN_C
  45. #endif /* __nsdbmgmt_h */