2019 |
mateusz.vi |
1 |
/* $Id: DB.H,v 1.1 2005-07-18 07:30:18 perditionc Exp $ */
|
|
|
2 |
|
|
|
3 |
/* include file for a simple key-value db */
|
|
|
4 |
|
|
|
5 |
/* Copyright (C) 1999,2000 Jim Hall <jhall1@isd.net> */
|
|
|
6 |
|
|
|
7 |
/*
|
|
|
8 |
This library is free software; you can redistribute it and/or
|
|
|
9 |
modify it under the terms of the GNU Lesser General Public
|
|
|
10 |
License as published by the Free Software Foundation; either
|
|
|
11 |
version 2.1 of the License, or (at your option) any later version.
|
|
|
12 |
|
|
|
13 |
This library is distributed in the hope that it will be useful,
|
|
|
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
16 |
Lesser General Public License for more details.
|
|
|
17 |
|
|
|
18 |
You should have received a copy of the GNU Lesser General Public
|
|
|
19 |
License along with this library; if not, write to the Free Software
|
|
|
20 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
21 |
*/
|
|
|
22 |
|
|
|
23 |
|
|
|
24 |
#ifndef _DB_H
|
|
|
25 |
#define _DB_H
|
|
|
26 |
|
|
|
27 |
#ifdef __cplusplus
|
|
|
28 |
extern "C" {
|
|
|
29 |
#endif
|
|
|
30 |
|
|
|
31 |
/* Symbolic constants */
|
|
|
32 |
|
|
|
33 |
#define HASHSIZE 101
|
|
|
34 |
|
|
|
35 |
/* Typedefs and structs */
|
|
|
36 |
|
|
|
37 |
struct db_list{
|
|
|
38 |
struct db_list *next;
|
|
|
39 |
char *key;
|
|
|
40 |
char *value;
|
|
|
41 |
};
|
|
|
42 |
|
|
|
43 |
typedef struct db_list db_t;
|
|
|
44 |
|
|
|
45 |
|
|
|
46 |
/* Functions */
|
|
|
47 |
|
|
|
48 |
/* db.c */
|
|
|
49 |
|
|
|
50 |
int db_init (size_t init_size);
|
|
|
51 |
int db_free (void);
|
|
|
52 |
db_t *db_insert (char *key, char *value);
|
|
|
53 |
int db_compare (db_t *p1, db_t *p2);
|
|
|
54 |
db_t *db_fetch (char *key);
|
|
|
55 |
|
|
|
56 |
#ifdef __cplusplus
|
|
|
57 |
}
|
|
|
58 |
#endif
|
|
|
59 |
|
|
|
60 |
#endif /* _DB_H */
|