php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
cdb.h
Go to the documentation of this file.
1/*
2 +----------------------------------------------------------------------+
3 | Copyright (c) The PHP Group |
4 +----------------------------------------------------------------------+
5 | This source file is subject to version 3.01 of the PHP license, |
6 | that is bundled with this package in the file LICENSE, and is |
7 | available through the world-wide-web at the following url: |
8 | https://www.php.net/license/3_01.txt |
9 | If you did not receive a copy of the PHP license and are unable to |
10 | obtain it through the world-wide-web, please send a note to |
11 | license@php.net so we can mail you a copy immediately. |
12 +----------------------------------------------------------------------+
13 | Author: Marcus Boerger <helly@php.net> |
14 +----------------------------------------------------------------------+
15 */
16
17/* incorporated from D.J.Bernstein's cdb-0.75 (http://cr.yp.to/cdb.html)*/
18
19#ifndef CDB_H
20#define CDB_H
21
22#include "uint32.h"
23
24#define CDB_HASHSTART 5381
25
26struct cdb {
28 uint32 loop; /* number of hash slots searched under this key */
29 uint32 khash; /* initialized if loop is nonzero */
30 uint32 kpos; /* initialized if loop is nonzero */
31 uint32 hpos; /* initialized if loop is nonzero */
32 uint32 hslots; /* initialized if loop is nonzero */
33 uint32 dpos; /* initialized if cdb_findnext() returns 1 */
34 uint32 dlen; /* initialized if cdb_findnext() returns 1 */
35};
36
37uint32 cdb_hash(char *, unsigned int);
38
39void cdb_free(struct cdb *);
40void cdb_init(struct cdb *, php_stream *fp);
41
42int cdb_read(struct cdb *, char *, unsigned int, uint32);
43
44void cdb_findstart(struct cdb *);
45int cdb_findnext(struct cdb *, char *, unsigned int);
46int cdb_find(struct cdb *, char *, unsigned int);
47
48#define cdb_datapos(c) ((c)->dpos)
49#define cdb_datalen(c) ((c)->dlen)
50
51const char *cdb_version(void);
52
53#endif
void cdb_findstart(struct cdb *)
Definition cdb.c:86
void cdb_free(struct cdb *)
Definition cdb.c:80
int cdb_findnext(struct cdb *, char *, unsigned int)
Definition cdb.c:127
void cdb_init(struct cdb *, php_stream *fp)
Definition cdb.c:93
int cdb_read(struct cdb *, char *, unsigned int, uint32)
Definition cdb.c:102
int cdb_find(struct cdb *, char *, unsigned int)
Definition cdb.c:180
uint32 cdb_hash(char *, unsigned int)
Definition cdb.c:66
const char * cdb_version(void)
Definition cdb.c:188
#define uint32
Definition lsapilib.c:92
struct _php_stream php_stream
Definition php_streams.h:96
Definition cdb.h:26
uint32 dlen
Definition cdb.h:34
uint32 loop
Definition cdb.h:28
uint32 khash
Definition cdb.h:29
php_stream * fp
Definition cdb.h:27
uint32 hslots
Definition cdb.h:32
uint32 kpos
Definition cdb.h:30
uint32 hpos
Definition cdb.h:31
uint32 dpos
Definition cdb.h:33