summaryrefslogtreecommitdiff
path: root/src/config/tipidee-config-internal.h
blob: e274f94d14b6d285d6ac448a9ff9f6cf3366f213 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* ISC license. */

#ifndef TIPIDEE_CONFIG_INTERNAL_H
#define TIPIDEE_CONFIG_INTERNAL_H

#include <stdint.h>
#include <string.h>

#include <skalibs/buffer.h>
#include <skalibs/stralloc.h>
#include <skalibs/cdbmake.h>

typedef struct confnode_s confnode, *confnode_ref ;
struct confnode_s
{
  uint32_t key ;
  uint32_t keylen ;
  uint32_t data ;
  uint32_t datalen ;
  uint32_t filepos ;
  uint32_t line ;
} ;
#define CONFNODE_ZERO { .key = 0, .keylen = 0, .data = 0, .datalen = 0 }

struct global_s
{
  stralloc storage ;
} ;
#define GLOBAL_ZERO { .storage = STRALLOC_ZERO }

extern struct global_s g ;


 /* confnode */

extern void confnode_start (confnode *, char const *, size_t, uint32_t) ;
extern void confnode_add (confnode *, char const *, size_t) ;
#define confnode_adds(node, s) confnode_add(node, (s), strlen(s))
#define confnode_add0(node) confnode_add((node), "", 1)


 /* conftree */

extern confnode const *conftree_search (char const *) ;
extern void conftree_add (confnode const *) ;
extern void conftree_update (confnode const *) ;
extern int conftree_write (cdbmaker *) ;


 /* lexparse */

extern void conf_lexparse (buffer *, char const *) ;


 /* defaults */

extern void conf_defaults (void) ;

#endif