ec7a3c1399ec53be83eeb8aa42f50e71abf485e4
[platform/upstream/gpg2.git] / kbx / keybox-search-desc.h
1 /* keybox-search-desc.h - Keybox serch description
2  *      Copyright (C) 2001 Free Software Foundation, Inc.
3  *
4  * This file is part of GnuPG.
5  *
6  * GnuPG is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * GnuPG is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, see <http://www.gnu.org/licenses/>.
18  */
19
20 /*
21    This file is a temporary kludge until we can come up with solution
22    to share this description between keybox and the application
23    specific keydb
24 */
25
26 #ifndef KEYBOX_SEARCH_DESC_H
27 #define KEYBOX_SEARCH_DESC_H 1
28
29 typedef enum {
30   KEYDB_SEARCH_MODE_NONE,
31   KEYDB_SEARCH_MODE_EXACT,
32   KEYDB_SEARCH_MODE_SUBSTR,
33   KEYDB_SEARCH_MODE_MAIL,
34   KEYDB_SEARCH_MODE_MAILSUB,
35   KEYDB_SEARCH_MODE_MAILEND,
36   KEYDB_SEARCH_MODE_WORDS,
37   KEYDB_SEARCH_MODE_SHORT_KID,
38   KEYDB_SEARCH_MODE_LONG_KID,
39   KEYDB_SEARCH_MODE_FPR16,
40   KEYDB_SEARCH_MODE_FPR20,
41   KEYDB_SEARCH_MODE_FPR,
42   KEYDB_SEARCH_MODE_ISSUER,
43   KEYDB_SEARCH_MODE_ISSUER_SN,
44   KEYDB_SEARCH_MODE_SN,
45   KEYDB_SEARCH_MODE_SUBJECT,
46   KEYDB_SEARCH_MODE_KEYGRIP,
47   KEYDB_SEARCH_MODE_FIRST,
48   KEYDB_SEARCH_MODE_NEXT
49 } KeydbSearchMode;
50
51
52 /* Forwward declaration.  See g10/packet.h.  */
53 struct gpg_pkt_user_id_s;
54 typedef struct gpg_pkt_user_id_s *gpg_pkt_user_id_t;
55
56 /* A search descriptor.  */
57 struct keydb_search_desc
58 {
59   KeydbSearchMode mode;
60   int (*skipfnc)(void *, u32 *, gpg_pkt_user_id_t);
61   void *skipfncvalue;
62   const unsigned char *sn;
63   int snlen;  /* -1 := sn is a hex string */
64   union {
65     const char *name;
66     unsigned char fpr[24];
67     u32 kid[2]; /* Note that this is in native endianess.  */
68     unsigned char grip[20];
69   } u;
70   int exact;    /* Use exactly this key ('!' suffix in gpg).  */
71 };
72
73
74 struct keydb_search_desc;
75 typedef struct keydb_search_desc KEYDB_SEARCH_DESC;
76 typedef struct keydb_search_desc KEYBOX_SEARCH_DESC;
77
78
79
80 #endif /*KEYBOX_SEARCH_DESC_H*/