chiark / gitweb /
agent: Avoid tight timer tick when possible.
[gnupg2.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 <https://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   /* Callback used to filter results.  The first parameter is
61      SKIPFUNCVALUE.  The second is the keyid.  The third is the
62      1-based index of the UID packet that matched the search criteria
63      (or 0, if none).
64
65      Return non-zero if the result should be skipped.  */
66   int (*skipfnc)(void *, u32 *, int);
67   void *skipfncvalue;
68   const unsigned char *sn;
69   int snlen;  /* -1 := sn is a hex string */
70   union {
71     const char *name;
72     unsigned char fpr[24];
73     u32 kid[2]; /* Note that this is in native endianness.  */
74     unsigned char grip[20];
75   } u;
76   int exact;    /* Use exactly this key ('!' suffix in gpg).  */
77 };
78
79
80 struct keydb_search_desc;
81 typedef struct keydb_search_desc KEYDB_SEARCH_DESC;
82 typedef struct keydb_search_desc KEYBOX_SEARCH_DESC;
83
84
85
86 #endif /*KEYBOX_SEARCH_DESC_H*/