1 /* context.h - Definitions for a GPGME context.
2 Copyright (C) 2000 Werner Koch (dd9jn)
3 Copyright (C) 2001, 2002, 2003, 2004, 2005 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, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
31 extern gpgme_error_t _gpgme_selftest;
33 /* Operations might require to remember arbitrary information and data
34 objects during invocations of the status handler. The
35 ctx_op_data structure provides a generic framework to hook in
36 such additional data. */
39 OPDATA_DECRYPT, OPDATA_SIGN, OPDATA_ENCRYPT, OPDATA_PASSPHRASE,
40 OPDATA_IMPORT, OPDATA_GENKEY, OPDATA_KEYLIST, OPDATA_EDIT,
41 OPDATA_VERIFY, OPDATA_TRUSTLIST, OPDATA_ASSUAN
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 /* True if armor mode should be used. */
93 unsigned int use_armor : 1;
95 /* True if text mode should be used. */
96 unsigned int use_textmode : 1;
98 /* Flags for keylist mode. */
99 gpgme_keylist_mode_t keylist_mode;
101 /* Number of certs to be included. */
102 unsigned int include_certs;
104 /* The number of keys in signers. */
105 unsigned int signers_len;
107 /* Size of the following array. */
108 unsigned int signers_size;
109 gpgme_key_t *signers;
111 /* The signature notations for this context. */
112 gpgme_sig_notation_t sig_notations;
114 /* The locale for the pinentry. */
118 /* The operation data hooked into the context. */
119 ctx_op_data_t op_data;
121 /* The user provided passphrase callback and its hook value. */
122 gpgme_passphrase_cb_t passphrase_cb;
123 void *passphrase_cb_value;
125 /* The user provided progress callback and its hook value. */
126 gpgme_progress_cb_t progress_cb;
127 void *progress_cb_value;
129 /* A list of file descriptors in active use by the current
132 struct gpgme_io_cbs io_cbs;
135 #endif /* CONTEXT_H */