summaryrefslogtreecommitdiffstats
path: root/src/dbstruct.h
blob: 842e33d631149c10f16aef01dc02cb10260b7a26 (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#ifndef foodbstructhfoo
#define foodbstructhfoo

/* $Id$ */

/***
  This file is part of syrep.

  syrep is free software; you can redistribute it and/or modify it
  under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
  
  syrep is distributed in the hope that it will be useful, but WITHOUT
  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
  License for more details.
  
  You should have received a copy of the GNU General Public License
  along with syrep; if not, write to the Free Software Foundation,
  Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***/

#include <limits.h>
#include <inttypes.h>

#include <db.h>

#include "syrep.h"

struct syrep_md {
    uint8_t digest[SYREP_DIGESTLENGTH]; 
};

struct syrep_nrecno {                        /* name record number */
    db_recno_t recno;
};

struct syrep_id {
    struct syrep_md md;
    struct syrep_nrecno nrecno;
};

struct syrep_meta {
    uint32_t first_seen;
    uint32_t last_seen;
};

struct syrep_timestamp {
    uint32_t t;
};

struct syrep_version {
    uint32_t v;
};

struct syrep_nhash {                     /* name hash */
    uint32_t hash;
};

struct syrep_name {
    char path[PATH_MAX];
};


/* Table layout:
 *
 * syrep_id :: syrep_meta           => id_meta 
 * syrep_md :: syrep_nrecno         => md_nrecno                           (DUP)
 * syrep_nrecno :: syrep_md         => nrecno_md                           (DUP)
 * syrep_nrecno :: syrep_md         => nrecno_lastmd
 * syrep_md :: syrep_nrecno         => md_lastnrecno
 *
 * syrep_version :: syrep_timestamp => version_timestamp
 *
 * nhash :: nrecno                  => nhash_nrecno                        (DUP)
 * nrecno :: name                   => nrecno_name
 */

#endif