1*3d8817e4Smiod /* GNU DBM - DataBase Manager include file 2*3d8817e4Smiod Copyright 1989, 1991 Free Software Foundation, Inc. 3*3d8817e4Smiod Written by Philip A. Nelson. 4*3d8817e4Smiod 5*3d8817e4Smiod This program is free software; you can redistribute it and/or modify 6*3d8817e4Smiod it under the terms of the GNU General Public License as published by 7*3d8817e4Smiod the Free Software Foundation; either version 2 of the License, or 8*3d8817e4Smiod (at your option) any later version. 9*3d8817e4Smiod 10*3d8817e4Smiod This program is distributed in the hope that it will be useful, 11*3d8817e4Smiod but WITHOUT ANY WARRANTY; without even the implied warranty of 12*3d8817e4Smiod MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13*3d8817e4Smiod GNU General Public License for more details. 14*3d8817e4Smiod 15*3d8817e4Smiod You should have received a copy of the GNU General Public License 16*3d8817e4Smiod along with this program; if not, write to the Free Software 17*3d8817e4Smiod Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ 18*3d8817e4Smiod 19*3d8817e4Smiod /* You may contact the author by: 20*3d8817e4Smiod e-mail: phil@wwu.edu 21*3d8817e4Smiod us-mail: Philip A. Nelson 22*3d8817e4Smiod Computer Science Department 23*3d8817e4Smiod Western Washington University 24*3d8817e4Smiod Bellingham, WA 98226 25*3d8817e4Smiod phone: (206) 676-3035 26*3d8817e4Smiod 27*3d8817e4Smiod *************************************************************************/ 28*3d8817e4Smiod 29*3d8817e4Smiod /* Parameters to gdbm_open for READERS, WRITERS, and WRITERS who 30*3d8817e4Smiod can create the database. */ 31*3d8817e4Smiod #define GDBM_READER 0 32*3d8817e4Smiod #define GDBM_WRITER 1 33*3d8817e4Smiod #define GDBM_WRCREAT 2 34*3d8817e4Smiod #define GDBM_NEWDB 3 35*3d8817e4Smiod 36*3d8817e4Smiod /* Parameters to gdbm_store for simple insertion or replacement. */ 37*3d8817e4Smiod #define GDBM_INSERT 0 38*3d8817e4Smiod #define GDBM_REPLACE 1 39*3d8817e4Smiod 40*3d8817e4Smiod 41*3d8817e4Smiod /* The data and key structure. This structure is defined for compatibility. */ 42*3d8817e4Smiod typedef struct { 43*3d8817e4Smiod char *dptr; 44*3d8817e4Smiod int dsize; 45*3d8817e4Smiod } datum; 46*3d8817e4Smiod 47*3d8817e4Smiod 48*3d8817e4Smiod /* The file information header. This is good enough for most applications. */ 49*3d8817e4Smiod typedef struct {int dummy[10];} *GDBM_FILE; 50*3d8817e4Smiod 51*3d8817e4Smiod 52*3d8817e4Smiod /* These are the routines! */ 53*3d8817e4Smiod 54*3d8817e4Smiod extern GDBM_FILE gdbm_open (); 55*3d8817e4Smiod 56*3d8817e4Smiod extern void gdbm_close (); 57*3d8817e4Smiod 58*3d8817e4Smiod extern datum gdbm_fetch (); 59*3d8817e4Smiod 60*3d8817e4Smiod extern int gdbm_store (); 61*3d8817e4Smiod 62*3d8817e4Smiod extern int gdbm_delete (); 63*3d8817e4Smiod 64*3d8817e4Smiod extern datum gdbm_firstkey (); 65*3d8817e4Smiod 66*3d8817e4Smiod extern datum gdbm_nextkey (); 67*3d8817e4Smiod 68*3d8817e4Smiod extern int gdbm_reorganize (); 69*3d8817e4Smiod 70*3d8817e4Smiod 71*3d8817e4Smiod /* gdbm sends back the following error codes in the variable gdbm_errno. */ 72*3d8817e4Smiod typedef enum { NO_ERROR, 73*3d8817e4Smiod MALLOC_ERROR, 74*3d8817e4Smiod BLOCK_SIZE_ERROR, 75*3d8817e4Smiod FILE_OPEN_ERROR, 76*3d8817e4Smiod FILE_WRITE_ERROR, 77*3d8817e4Smiod FILE_SEEK_ERROR, 78*3d8817e4Smiod FILE_READ_ERROR, 79*3d8817e4Smiod BAD_MAGIC_NUMBER, 80*3d8817e4Smiod EMPTY_DATABASE, 81*3d8817e4Smiod CANT_BE_READER, 82*3d8817e4Smiod CANT_BE_WRITER, 83*3d8817e4Smiod READER_CANT_RECOVER, 84*3d8817e4Smiod READER_CANT_DELETE, 85*3d8817e4Smiod READER_CANT_STORE, 86*3d8817e4Smiod READER_CANT_REORGANIZE, 87*3d8817e4Smiod UNKNOWN_UPDATE, 88*3d8817e4Smiod ITEM_NOT_FOUND, 89*3d8817e4Smiod REORGANIZE_FAILED, 90*3d8817e4Smiod CANNOT_REPLACE} 91*3d8817e4Smiod gdbm_error; 92