1 /* 2 +----------------------------------------------------------------------+ 3 | PHP Version 7 | 4 +----------------------------------------------------------------------+ 5 | Copyright (c) The PHP Group | 6 +----------------------------------------------------------------------+ 7 | This source file is subject to version 3.01 of the PHP license, | 8 | that is bundled with this package in the file LICENSE, and is | 9 | available through the world-wide-web at the following url: | 10 | http://www.php.net/license/3_01.txt | 11 | If you did not receive a copy of the PHP license and are unable to | 12 | obtain it through the world-wide-web, please send a note to | 13 | license@php.net so we can mail you a copy immediately. | 14 +----------------------------------------------------------------------+ 15 | Author: Marcus Boerger <helly@php.net> | 16 +----------------------------------------------------------------------+ 17 */ 18 19 #ifndef PHP_LIB_FLATFILE_H 20 #define PHP_LIB_FLATFILE_H 21 22 typedef struct { 23 char *dptr; 24 size_t dsize; 25 } datum; 26 27 typedef struct { 28 char *lockfn; 29 int lockfd; 30 php_stream *fp; 31 size_t CurrentFlatFilePos; 32 datum nextkey; 33 } flatfile; 34 35 #define FLATFILE_INSERT 1 36 #define FLATFILE_REPLACE 0 37 38 int flatfile_store(flatfile *dba, datum key_datum, datum value_datum, int mode); 39 datum flatfile_fetch(flatfile *dba, datum key_datum); 40 int flatfile_delete(flatfile *dba, datum key_datum); 41 int flatfile_findkey(flatfile *dba, datum key_datum); 42 datum flatfile_firstkey(flatfile *dba); 43 datum flatfile_nextkey(flatfile *dba); 44 char *flatfile_version(); 45 46 #endif 47