summaryrefslogtreecommitdiff
path: root/src/include/skalibs/cdbmake.h
blob: 0da0a86e2bebc08fd91dc74b70eff51e674edff4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* ISC license. */

#ifndef SKALIBS_CDBMAKE_H
#define SKALIBS_CDBMAKE_H

#include <stdint.h>

#include <skalibs/diuint32.h>
#include <skalibs/allreadwrite.h>
#include <skalibs/genalloc.h>
#include <skalibs/buffer.h>

typedef struct cdbmaker_s cdbmaker, *cdbmaker_ref ;
struct cdbmaker_s
{
  genalloc hplist ; /* array of diuint32 */
  uint32_t pos ;
  buffer b ;
  char buf[BUFFER_OUTSIZE] ;
} ;

#define CDBMAKER_ZERO { .hplist = GENALLOC_ZERO, .pos = 2048, .b = BUFFER_INIT(&fd_writev, -1, 0, 0) }

extern int cdbmake_start (cdbmaker *, int) ;
extern int cdbmake_add (cdbmaker *, char const *, uint32_t, char const *, uint32_t) ;
extern int cdbmake_finish (cdbmaker *) ;

#endif