1130812Smarcel/* GNU DBM - DataBase Manager include file
2130812Smarcel   Copyright 1989, 1991  Free Software Foundation, Inc.
3130812Smarcel   Written by Philip A. Nelson.
4130812Smarcel
5130812SmarcelThis program is free software; you can redistribute it and/or modify
6130812Smarcelit under the terms of the GNU General Public License as published by
7130812Smarcelthe Free Software Foundation; either version 2 of the License, or
8130812Smarcel(at your option) any later version.
9130812Smarcel
10130812SmarcelThis program is distributed in the hope that it will be useful,
11130812Smarcelbut WITHOUT ANY WARRANTY; without even the implied warranty of
12130812SmarcelMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13130812SmarcelGNU General Public License for more details.
14130812Smarcel
15130812SmarcelYou should have received a copy of the GNU General Public License
16130812Smarcelalong with this program; if not, write to the Free Software
17130812SmarcelFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
18130812Smarcel
19130812Smarcel/* You may contact the author by:
20130812Smarcel       e-mail:  phil@wwu.edu
21130812Smarcel      us-mail:  Philip A. Nelson
22130812Smarcel                Computer Science Department
23130812Smarcel                Western Washington University
24130812Smarcel                Bellingham, WA 98226
25130812Smarcel        phone:  (206) 676-3035
26130812Smarcel
27130812Smarcel*************************************************************************/
28130812Smarcel
29130812Smarcel/* Parameters to gdbm_open for READERS, WRITERS, and WRITERS who
30130812Smarcel   can create the database. */
31130812Smarcel#define  GDBM_READER  0
32130812Smarcel#define  GDBM_WRITER  1
33130812Smarcel#define  GDBM_WRCREAT 2
34130812Smarcel#define  GDBM_NEWDB   3
35130812Smarcel
36130812Smarcel/* Parameters to gdbm_store for simple insertion or replacement. */
37130812Smarcel#define  GDBM_INSERT  0
38130812Smarcel#define  GDBM_REPLACE 1
39130812Smarcel
40130812Smarcel
41130812Smarcel/* The data and key structure.  This structure is defined for compatibility. */
42130812Smarceltypedef struct {
43130812Smarcel	char *dptr;
44130812Smarcel	int   dsize;
45130812Smarcel      } datum;
46130812Smarcel
47130812Smarcel
48130812Smarcel/* The file information header. This is good enough for most applications. */
49130812Smarceltypedef struct {int dummy[10];} *GDBM_FILE;
50130812Smarcel
51130812Smarcel
52130812Smarcel/* These are the routines! */
53130812Smarcel
54130812Smarcelextern GDBM_FILE gdbm_open ();
55130812Smarcel
56130812Smarcelextern void	 gdbm_close ();
57130812Smarcel
58130812Smarcelextern datum	 gdbm_fetch ();
59130812Smarcel
60130812Smarcelextern int	 gdbm_store ();
61130812Smarcel
62130812Smarcelextern int	 gdbm_delete ();
63130812Smarcel
64130812Smarcelextern datum	 gdbm_firstkey ();
65130812Smarcel
66130812Smarcelextern datum	 gdbm_nextkey ();
67130812Smarcel
68130812Smarcelextern int	 gdbm_reorganize ();
69130812Smarcel
70130812Smarcel
71130812Smarcel/* gdbm sends back the following error codes in the variable gdbm_errno. */
72130812Smarceltypedef enum {	NO_ERROR,
73130812Smarcel		MALLOC_ERROR,
74130812Smarcel		BLOCK_SIZE_ERROR,
75130812Smarcel		FILE_OPEN_ERROR,
76130812Smarcel		FILE_WRITE_ERROR,
77130812Smarcel		FILE_SEEK_ERROR,
78130812Smarcel		FILE_READ_ERROR,
79130812Smarcel		BAD_MAGIC_NUMBER,
80130812Smarcel		EMPTY_DATABASE,
81130812Smarcel		CANT_BE_READER,
82130812Smarcel	        CANT_BE_WRITER,
83130812Smarcel		READER_CANT_RECOVER,
84130812Smarcel		READER_CANT_DELETE,
85130812Smarcel		READER_CANT_STORE,
86130812Smarcel		READER_CANT_REORGANIZE,
87130812Smarcel		UNKNOWN_UPDATE,
88130812Smarcel		ITEM_NOT_FOUND,
89130812Smarcel		REORGANIZE_FAILED,
90130812Smarcel		CANNOT_REPLACE}
91130812Smarcel	gdbm_error;
92