|
Packit |
d7e8d0 |
/* context.h - Definitions for a GPGME context.
|
|
Packit |
d7e8d0 |
Copyright (C) 2000 Werner Koch (dd9jn)
|
|
Packit |
d7e8d0 |
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2010 g10 Code GmbH
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
This file is part of GPGME.
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
GPGME is free software; you can redistribute it and/or modify it
|
|
Packit |
d7e8d0 |
under the terms of the GNU Lesser General Public License as
|
|
Packit |
d7e8d0 |
published by the Free Software Foundation; either version 2.1 of
|
|
Packit |
d7e8d0 |
the License, or (at your option) any later version.
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
GPGME is distributed in the hope that it will be useful, but
|
|
Packit |
d7e8d0 |
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
d7e8d0 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
d7e8d0 |
Lesser General Public License for more details.
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
You should have received a copy of the GNU Lesser General Public
|
|
Packit |
d7e8d0 |
License along with this program; if not, see <https://www.gnu.org/licenses/>.
|
|
Packit |
d7e8d0 |
*/
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
#ifndef CONTEXT_H
|
|
Packit |
d7e8d0 |
#define CONTEXT_H
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
#include "gpgme.h"
|
|
Packit |
d7e8d0 |
#include "engine.h"
|
|
Packit |
d7e8d0 |
#include "wait.h"
|
|
Packit |
d7e8d0 |
#include "sema.h"
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
extern gpgme_error_t _gpgme_selftest;
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
/* Operations might require to remember arbitrary information and data
|
|
Packit |
d7e8d0 |
objects during invocations of the status handler. The
|
|
Packit |
d7e8d0 |
ctx_op_data structure provides a generic framework to hook in
|
|
Packit |
d7e8d0 |
such additional data. */
|
|
Packit |
d7e8d0 |
typedef enum
|
|
Packit |
d7e8d0 |
{
|
|
Packit |
d7e8d0 |
OPDATA_DECRYPT, OPDATA_SIGN, OPDATA_ENCRYPT, OPDATA_PASSPHRASE,
|
|
Packit |
d7e8d0 |
OPDATA_IMPORT, OPDATA_GENKEY, OPDATA_KEYLIST, OPDATA_EDIT,
|
|
Packit |
d7e8d0 |
OPDATA_VERIFY, OPDATA_TRUSTLIST, OPDATA_ASSUAN, OPDATA_VFS_MOUNT,
|
|
Packit |
d7e8d0 |
OPDATA_PASSWD, OPDATA_EXPORT, OPDATA_KEYSIGN, OPDATA_TOFU_POLICY,
|
|
Packit |
d7e8d0 |
OPDATA_QUERY_SWDB
|
|
Packit |
d7e8d0 |
} ctx_op_data_id_t;
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
/* "gpgmeres" in ASCII. */
|
|
Packit |
d7e8d0 |
#define CTX_OP_DATA_MAGIC 0x736572656d677067ULL
|
|
Packit |
d7e8d0 |
struct ctx_op_data
|
|
Packit |
d7e8d0 |
{
|
|
Packit |
d7e8d0 |
/* A magic word just to make sure people don't deallocate something
|
|
Packit |
d7e8d0 |
that ain't a result structure. */
|
|
Packit |
d7e8d0 |
unsigned long long magic;
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
/* The next element in the linked list, or NULL if this is the last
|
|
Packit |
d7e8d0 |
element. Used by op data structures linked into a context. */
|
|
Packit |
d7e8d0 |
struct ctx_op_data *next;
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
/* The type of the hook data, which can be used by a routine to
|
|
Packit |
d7e8d0 |
lookup the hook data. */
|
|
Packit |
d7e8d0 |
ctx_op_data_id_t type;
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
/* The function to release HOOK and all its associated resources.
|
|
Packit |
d7e8d0 |
Can be NULL if no special deallocation routine is necessary. */
|
|
Packit |
d7e8d0 |
void (*cleanup) (void *hook);
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
/* The hook that points to the operation data. */
|
|
Packit |
d7e8d0 |
void *hook;
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
/* The number of outstanding references. */
|
|
Packit |
d7e8d0 |
int references;
|
|
Packit |
d7e8d0 |
};
|
|
Packit |
d7e8d0 |
typedef struct ctx_op_data *ctx_op_data_t;
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
/* The context defines an environment in which crypto operations can
|
|
Packit |
d7e8d0 |
be performed (sequentially). */
|
|
Packit |
d7e8d0 |
struct gpgme_context
|
|
Packit |
d7e8d0 |
{
|
|
Packit |
d7e8d0 |
DECLARE_LOCK (lock);
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
/* True if the context was canceled asynchronously. */
|
|
Packit |
d7e8d0 |
int canceled;
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
/* The engine info for this context. */
|
|
Packit |
d7e8d0 |
gpgme_engine_info_t engine_info;
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
/* The protocol used by this context. */
|
|
Packit |
d7e8d0 |
gpgme_protocol_t protocol;
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
/* The running engine process. */
|
|
Packit |
d7e8d0 |
engine_t engine;
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
/* Engine's sub protocol. */
|
|
Packit |
d7e8d0 |
gpgme_protocol_t sub_protocol;
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
/* True if armor mode should be used. */
|
|
Packit |
d7e8d0 |
unsigned int use_armor : 1;
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
/* True if text mode should be used. */
|
|
Packit |
d7e8d0 |
unsigned int use_textmode : 1;
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
/* True if offline mode should be used. */
|
|
Packit |
d7e8d0 |
unsigned int offline : 1;
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
/* True if a status callback shall be called for nearly all status
|
|
Packit |
d7e8d0 |
* lines. */
|
|
Packit |
d7e8d0 |
unsigned int full_status : 1;
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
/* The Tofu info has a human readable string which is presented to
|
|
Packit |
d7e8d0 |
* the user in a directly usable format. By enabling this flag the
|
|
Packit |
d7e8d0 |
* unmodified string, as received form gpg, will be returned. */
|
|
Packit |
d7e8d0 |
unsigned int raw_description : 1;
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
/* True if session keys should be exported upon decryption. */
|
|
Packit |
d7e8d0 |
unsigned int export_session_keys : 1;
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
/* True if a Pinentry was launched during the last operation. This
|
|
Packit |
d7e8d0 |
* flag is cleared with each operation. */
|
|
Packit |
d7e8d0 |
unsigned int redraw_suggested : 1;
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
/* True if the option --auto-key-retrieve shall be passed to gpg. */
|
|
Packit |
d7e8d0 |
unsigned int auto_key_retrieve : 1;
|
|
Packit |
d7e8d0 |
|
|
Packit Service |
30b792 |
/* Do not use the symmtric encryption passphrase cache. */
|
|
Packit Service |
30b792 |
unsigned int no_symkey_cache : 1;
|
|
Packit Service |
30b792 |
|
|
Packit Service |
30b792 |
/* Pass --ignore-mdc-error to gpg. Note that this flag is reset
|
|
Packit Service |
30b792 |
* after the operation. */
|
|
Packit Service |
30b792 |
unsigned int ignore_mdc_error : 1;
|
|
Packit Service |
30b792 |
|
|
Packit |
d7e8d0 |
/* Flags for keylist mode. */
|
|
Packit |
d7e8d0 |
gpgme_keylist_mode_t keylist_mode;
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
/* The current pinentry mode. */
|
|
Packit |
d7e8d0 |
gpgme_pinentry_mode_t pinentry_mode;
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
/* Number of certs to be included. */
|
|
Packit |
d7e8d0 |
unsigned int include_certs;
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
/* The actual number of keys in SIGNERS, the allocated size of the
|
|
Packit |
d7e8d0 |
* array, and the array with the signing keys. */
|
|
Packit |
d7e8d0 |
unsigned int signers_len;
|
|
Packit |
d7e8d0 |
unsigned int signers_size;
|
|
Packit |
d7e8d0 |
gpgme_key_t *signers;
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
/* The signature notations for this context. */
|
|
Packit |
d7e8d0 |
gpgme_sig_notation_t sig_notations;
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
/* The sender's addr-spec or NULL. */
|
|
Packit |
d7e8d0 |
char *sender;
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
/* The gpg specific override session key or NULL. */
|
|
Packit |
d7e8d0 |
char *override_session_key;
|
|
Packit |
d7e8d0 |
|
|
Packit Service |
30b792 |
/* The optional request origin. */
|
|
Packit Service |
30b792 |
char *request_origin;
|
|
Packit Service |
30b792 |
|
|
Packit Service |
30b792 |
/* The optional auto key locate options. */
|
|
Packit Service |
30b792 |
char *auto_key_locate;
|
|
Packit Service |
30b792 |
|
|
Packit |
d7e8d0 |
/* The locale for the pinentry. */
|
|
Packit |
d7e8d0 |
char *lc_ctype;
|
|
Packit |
d7e8d0 |
char *lc_messages;
|
|
Packit |
d7e8d0 |
|
|
Packit Service |
30b792 |
/* The optional trust-model override. */
|
|
Packit Service |
30b792 |
char *trust_model;
|
|
Packit Service |
30b792 |
|
|
Packit |
d7e8d0 |
/* The operation data hooked into the context. */
|
|
Packit |
d7e8d0 |
ctx_op_data_t op_data;
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
/* The user provided passphrase callback and its hook value. */
|
|
Packit |
d7e8d0 |
gpgme_passphrase_cb_t passphrase_cb;
|
|
Packit |
d7e8d0 |
void *passphrase_cb_value;
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
/* The user provided progress callback and its hook value. */
|
|
Packit |
d7e8d0 |
gpgme_progress_cb_t progress_cb;
|
|
Packit |
d7e8d0 |
void *progress_cb_value;
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
/* The user provided status callback and its hook value. */
|
|
Packit |
d7e8d0 |
gpgme_status_cb_t status_cb;
|
|
Packit |
d7e8d0 |
void *status_cb_value;
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
/* A list of file descriptors in active use by the current
|
|
Packit |
d7e8d0 |
operation. */
|
|
Packit |
d7e8d0 |
struct fd_table fdt;
|
|
Packit |
d7e8d0 |
struct gpgme_io_cbs io_cbs;
|
|
Packit |
d7e8d0 |
};
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
#endif /* CONTEXT_H */
|