fehQlibs 26
Qlibs
Loading...
Searching...
No Matches
cdbread.h
Go to the documentation of this file.
1/* Public domain. */
2
3#ifndef CDB_H
4#define CDB_H
5
6#include "uint_t.h"
7
8#define CDB_HASHSTART 5381ULL
9extern uint32 cdb_hashadd(uint32,unsigned char);
10extern uint32 cdb_hash(char *,unsigned int);
11extern uint32 cdb_unpack(unsigned char *);
12
13struct cdb {
14 char *map; /* 0 if no map is available */
15 int fd;
16 uint32 size; /* initialized if map is nonzero */
17 uint32 loop; /* number of hash slots searched under this key */
18 uint32 khash; /* initialized if loop is nonzero */
19 uint32 kpos; /* initialized if loop is nonzero */
20 uint32 hpos; /* initialized if loop is nonzero */
21 uint32 hslots; /* initialized if loop is nonzero */
22 uint32 dpos; /* initialized if cdb_findnext() returns 1 */
23 uint32 dlen; /* initialized if cdb_findnext() returns 1 */
24} ;
25
26extern void cdb_free(struct cdb *);
27extern void cdb_init(struct cdb *,int fd);
28
29extern int cdb_read(struct cdb *,char *,unsigned int,uint32);
30
31extern void cdb_findstart(struct cdb *);
32extern int cdb_findnext(struct cdb *,char *,unsigned int);
33extern int cdb_find(struct cdb *,char *,unsigned int);
34
35#define cdb_datapos(c) ((c)->dpos)
36#define cdb_datalen(c) ((c)->dlen)
37
38#endif
void cdb_init(struct cdb *, int fd)
Definition: cdbread.c:40
void cdb_findstart(struct cdb *)
Definition: cdbread.c:35
void cdb_free(struct cdb *)
Definition: cdbread.c:27
uint32 cdb_unpack(unsigned char *)
Definition: cdbread.c:17
int cdb_findnext(struct cdb *, char *, unsigned int)
Definition: cdbread.c:102
int cdb_read(struct cdb *, char *, unsigned int, uint32)
Definition: cdbread.c:59
int cdb_find(struct cdb *, char *, unsigned int)
Definition: cdbread.c:147
uint32 cdb_hash(char *, unsigned int)
Definition: cdbread.c:159
uint32 cdb_hashadd(uint32, unsigned char)
Definition: cdbread.c:153
additional types and pack routines
uint32_t uint32
Definition: uint_t.h:40
Definition: cdbread.h:13
uint32 size
Definition: cdbread.h:16
uint32 hslots
Definition: cdbread.h:21
uint32 hpos
Definition: cdbread.h:20
uint32 khash
Definition: cdbread.h:18
int fd
Definition: cdbread.h:15
char * map
Definition: cdbread.h:14
uint32 dpos
Definition: cdbread.h:22
uint32 loop
Definition: cdbread.h:17
uint32 dlen
Definition: cdbread.h:23
uint32 kpos
Definition: cdbread.h:19