2012-11-19 14:53:00 -07:00
|
|
|
#ifndef __CDB_H__
|
|
|
|
#define __CDB_H__
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
struct cdb_ctx {
|
|
|
|
FILE *f;
|
|
|
|
|
|
|
|
char *key;
|
|
|
|
uint32_t keylen;
|
|
|
|
|
|
|
|
uint32_t hash_val;
|
|
|
|
uint32_t hash_pos;
|
|
|
|
uint32_t hash_len;
|
|
|
|
|
|
|
|
uint32_t entry;
|
|
|
|
};
|
|
|
|
|
|
|
|
void cdb_init(struct cdb_ctx *ctx, FILE *f);
|
2012-11-20 18:13:16 -07:00
|
|
|
int cdb_dump(struct cdb_ctx *ctx,
|
|
|
|
char *key, size_t *keylen,
|
|
|
|
char *val, size_t *vallen);
|
|
|
|
void cdb_find(struct cdb_ctx *ctx, char *key, size_t keylen);
|
|
|
|
uint32_t cdb_next(struct cdb_ctx *ctx, char *buf, size_t buflen);
|
2012-11-19 14:53:00 -07:00
|
|
|
|
|
|
|
#endif
|