Back to index

php5  5.3.10
cdb.h
Go to the documentation of this file.
00001 /*
00002    +----------------------------------------------------------------------+
00003    | PHP Version 5                                                        |
00004    +----------------------------------------------------------------------+
00005    | Copyright (c) 1997-2010 The PHP Group                                |
00006    +----------------------------------------------------------------------+
00007    | This source file is subject to version 3.01 of the PHP license,      |
00008    | that is bundled with this package in the file LICENSE, and is        |
00009    | available through the world-wide-web at the following url:           |
00010    | http://www.php.net/license/3_01.txt                                  |
00011    | If you did not receive a copy of the PHP license and are unable to   |
00012    | obtain it through the world-wide-web, please send a note to          |
00013    | license@php.net so we can mail you a copy immediately.               |
00014    +----------------------------------------------------------------------+
00015    | Author: Marcus Boerger <helly@php.net>                               |
00016    +----------------------------------------------------------------------+
00017  */
00018 
00019 /* $Id: cdb.h 293036 2010-01-03 09:23:27Z sebastian $ */
00020 
00021 /* incorporated from D.J.Bernstein's cdb-0.75 (http://cr.yp.to/cdb.html)*/
00022 
00023 #ifndef CDB_H
00024 #define CDB_H
00025 
00026 #include "uint32.h"
00027 
00028 #define CDB_HASHSTART 5381
00029 
00030 struct cdb {
00031        php_stream *fp;
00032        uint32 loop; /* number of hash slots searched under this key */
00033        uint32 khash; /* initialized if loop is nonzero */
00034        uint32 kpos; /* initialized if loop is nonzero */
00035        uint32 hpos; /* initialized if loop is nonzero */
00036        uint32 hslots; /* initialized if loop is nonzero */
00037        uint32 dpos; /* initialized if cdb_findnext() returns 1 */
00038        uint32 dlen; /* initialized if cdb_findnext() returns 1 */
00039 };
00040 
00041 uint32 cdb_hash(char *, unsigned int);
00042 
00043 void cdb_free(struct cdb * TSRMLS_DC);
00044 void cdb_init(struct cdb *, php_stream *fp TSRMLS_DC);
00045 
00046 int cdb_read(struct cdb *, char *, unsigned int, uint32 TSRMLS_DC);
00047 
00048 void cdb_findstart(struct cdb * TSRMLS_DC);
00049 int cdb_findnext(struct cdb *, char *, unsigned int TSRMLS_DC);
00050 int cdb_find(struct cdb *, char *, unsigned int TSRMLS_DC);
00051 
00052 #define cdb_datapos(c) ((c)->dpos)
00053 #define cdb_datalen(c) ((c)->dlen)
00054 
00055 char *cdb_version();
00056 
00057 #endif