Tizen 2.0 Release
[external/libgnutls26.git] / lib / opencdk / keydb.h
1 /* Internal key index structure. */
2 struct key_idx_s
3 {
4   off_t offset;
5   u32 keyid[2];
6   byte fpr[KEY_FPR_LEN];
7 };
8 typedef struct key_idx_s *key_idx_t;
9
10 /* Internal key cache to associate a key with an file offset. */
11 struct key_table_s
12 {
13   struct key_table_s *next;
14   off_t offset;
15 };
16 typedef struct key_table_s *key_table_t;
17
18 typedef struct cdk_keydb_search_s
19 {
20   off_t off;                    /* last file offset */
21   union
22   {
23     char *pattern;              /* A search is performed by pattern. */
24     u32 keyid[2];               /* A search by keyid. */
25     byte fpr[KEY_FPR_LEN];      /* A search by fingerprint. */
26   } u;
27   int type;
28   struct key_table_s *cache;
29   size_t ncache;
30   unsigned int no_cache:1;      /* disable the index cache. */
31
32   cdk_stream_t idx;
33   char *idx_name;               /* name of the index file or NULL. */
34
35 } cdk_keydb_search_s;
36
37 /* Internal key database handle. */
38 struct cdk_keydb_hd_s
39 {
40   int type;                     /* type of the key db handle. */
41   int fp_ref;                   /* 1=means it is a reference and shall not be closed. */
42   cdk_stream_t fp;
43   char *name;                   /* name of the underlying file or NULL. */
44   unsigned int secret:1;        /* contain secret keys. */
45   unsigned int isopen:1;        /* the underlying stream is opened. */
46
47   /* structure to store some stats about the keydb. */
48   struct
49   {
50     size_t new_keys;            /* amount of new keys that were imported. */
51   } stats;
52 };