1 /* context.h - Definitions for a GPGME context.
2 Copyright (C) 2000 Werner Koch (dd9jn)
3 Copyright (C) 2001, 2002, 2003, 2004, 2005, 2010 g10 Code GmbH
5 This file is part of GPGME.
7 GPGME is free software; you can redistribute it and/or modify it
8 under the terms of the GNU Lesser General Public License as
9 published by the Free Software Foundation; either version 2.1 of
10 the License, or (at your option) any later version.
12 GPGME is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
17 You should have received a copy of the GNU Lesser General Public
18 License along with this program; if not, see <http://www.gnu.org/licenses/>.
30 extern gpgme_error_t _gpgme_selftest;
32 /* Operations might require to remember arbitrary information and data
33 objects during invocations of the status handler. The
34 ctx_op_data structure provides a generic framework to hook in
35 such additional data. */
38 OPDATA_DECRYPT, OPDATA_SIGN, OPDATA_ENCRYPT, OPDATA_PASSPHRASE,
39 OPDATA_IMPORT, OPDATA_GENKEY, OPDATA_KEYLIST, OPDATA_EDIT,
40 OPDATA_VERIFY, OPDATA_TRUSTLIST, OPDATA_ASSUAN, OPDATA_VFS_MOUNT,
45 /* "gpgmeres" in ASCII. */
46 #define CTX_OP_DATA_MAGIC 0x736572656d677067ULL
49 /* A magic word just to make sure people don't deallocate something
50 that ain't a result structure. */
51 unsigned long long magic;
53 /* The next element in the linked list, or NULL if this is the last
54 element. Used by op data structures linked into a context. */
55 struct ctx_op_data *next;
57 /* The type of the hook data, which can be used by a routine to
58 lookup the hook data. */
59 ctx_op_data_id_t type;
61 /* The function to release HOOK and all its associated resources.
62 Can be NULL if no special deallocation routine is necessary. */
63 void (*cleanup) (void *hook);
65 /* The hook that points to the operation data. */
68 /* The number of outstanding references. */
71 typedef struct ctx_op_data *ctx_op_data_t;
74 /* The context defines an environment in which crypto operations can
75 be performed (sequentially). */
80 /* True if the context was canceled asynchronously. */
83 /* The engine info for this context. */
84 gpgme_engine_info_t engine_info;
86 /* The protocol used by this context. */
87 gpgme_protocol_t protocol;
89 /* The running engine process. */
92 /* Engine's sub protocol. */
93 gpgme_protocol_t sub_protocol;
95 /* True if armor mode should be used. */
96 unsigned int use_armor : 1;
98 /* True if text mode should be used. */
99 unsigned int use_textmode : 1;
101 /* Flags for keylist mode. */
102 gpgme_keylist_mode_t keylist_mode;
104 /* Number of certs to be included. */
105 unsigned int include_certs;
107 /* The number of keys in signers. */
108 unsigned int signers_len;
110 /* Size of the following array. */
111 unsigned int signers_size;
112 gpgme_key_t *signers;
114 /* The signature notations for this context. */
115 gpgme_sig_notation_t sig_notations;
117 /* The locale for the pinentry. */
121 /* The operation data hooked into the context. */
122 ctx_op_data_t op_data;
124 /* The user provided passphrase callback and its hook value. */
125 gpgme_passphrase_cb_t passphrase_cb;
126 void *passphrase_cb_value;
128 /* The user provided progress callback and its hook value. */
129 gpgme_progress_cb_t progress_cb;
130 void *progress_cb_value;
132 /* A list of file descriptors in active use by the current
135 struct gpgme_io_cbs io_cbs;
138 #endif /* CONTEXT_H */