ba333bf07e
2003-04-30 Marcus Brinkmann <marcus@g10code.de> * gpgme.texi (Key Listing Mode): Add GPGME_KEYLIST_MODE_SIGS. (Manipulating Keys): Add obsoleteness note. (Key Signatures): Likewise. (Information About Keys): Likewise. (Key Management): Add new data types GpgmeSubkey, GpgmeKeySig, GpgmeUserID, and all the information about GpgmeKey. gpgme/ 2003-04-30 Marcus Brinkmann <marcus@g10code.de> * gpgme.h (struct _gpgme_key): New structure. (GpgmeKey): Define using _gpgme_key. (struct _gpgme_subkey): New structure. (GpgmeSubKey): New type. (struct _gpgme_key_sig): New structure. (GpgmeKeySig): New type. (struct _gpgme_user_id): New structure. (GpgmeUserID): New type. (struct _gpgme_op_keylist_result): New structure. (GpgmeKeyListResult): New type. (gpgme_op_keylist_result): New function. (gpgme_key_get_as_xml): Remove prototype. * context.h (struct gpgme_context_s): Remove members tmp_key, tmp_uid, key_cond and key_queue. (struct key_queue_item_s): Remove structure. (struct user_id_s): Remove structure. (struct gpgme_recipients_s): Replace with simple GpgmeUserID list. * gpgme.c (gpgme_release): Do not release CTX->tmp_key. * ops.h (_gpgme_key_add_subkey, _gpgme_key_append_name, _gpgme_key_add_sig, _gpgme_trust_item_new): New prototypes. * rungpg.c (command_cb): Return GpgmeError instead int. New variable ERR. Use it to hold return value of cmd handler. (gpg_delete): Access fingerprint of key directly. (append_args_from_signers): Likewise. (gpg_edit): Likewise. (append_args_from_recipients): Use GpgmeUserID for recipient list. * engine-gpgsm.c: Do not include "key.h". (gpgsm_delete): Access fingerprint of key directly. (gpgsm_sign): Likewise. (set_recipients): Use GpgmeUserID for recipients. Invert invalid user ID flag. * key.h: File removed. * key.c: Completely reworked to use exposed GpgmeKey data types. * keylist.c: Likewise. * recipient.c: Completely reworked to use GpgmeUserID. tests/ 2003-04-30 Marcus Brinkmann <marcus@g10code.de> * gpg/t-keylist.c: Rewritten. * gpgsm/t-keylist.c (main): Rewritten. * gpg/t-edit.c (main): Do not use gpgme_key_get_as_xml. Use gpgme_key_unref instead gpgme_key_release. * gpg/t-signers.c (main): Use gpgme_key_unref instead gpgme_key_release.
117 lines
3.2 KiB
C
117 lines
3.2 KiB
C
/* context.h - Definitions for a GPGME context.
|
||
Copyright (C) 2000 Werner Koch (dd9jn)
|
||
Copyright (C) 2001, 2002, 2003 g10 Code GmbH
|
||
|
||
This file is part of GPGME.
|
||
|
||
GPGME is free software; you can redistribute it and/or modify it
|
||
under the terms of the GNU General Public License as published by
|
||
the Free Software Foundation; either version 2 of the License, or
|
||
(at your option) any later version.
|
||
|
||
GPGME is distributed in the hope that it will be useful, but
|
||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||
General Public License for more details.
|
||
|
||
You should have received a copy of the GNU General Public License
|
||
along with GPGME; if not, write to the Free Software Foundation,
|
||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||
|
||
#ifndef CONTEXT_H
|
||
#define CONTEXT_H
|
||
|
||
#include "gpgme.h"
|
||
#include "engine.h"
|
||
#include "wait.h"
|
||
|
||
|
||
/* Operations might require to remember arbitrary information and data
|
||
objects during invocations of the status handler. The
|
||
ctx_op_data structure provides a generic framework to hook in
|
||
such additional data. */
|
||
typedef enum
|
||
{
|
||
OPDATA_DECRYPT, OPDATA_SIGN, OPDATA_ENCRYPT, OPDATA_PASSPHRASE,
|
||
OPDATA_IMPORT, OPDATA_GENKEY, OPDATA_KEYLIST, OPDATA_EDIT,
|
||
OPDATA_VERIFY, OPDATA_TRUSTLIST
|
||
} ctx_op_data_type;
|
||
|
||
struct ctx_op_data
|
||
{
|
||
/* The next element in the linked list, or NULL if this is the last
|
||
element. */
|
||
struct ctx_op_data *next;
|
||
|
||
/* The type of the hook data, which can be used by a routine to
|
||
lookup the hook data. */
|
||
ctx_op_data_type type;
|
||
|
||
/* The function to release HOOK and all its associated resources.
|
||
Can be NULL if no special dealllocation routine is necessary. */
|
||
void (*cleanup) (void *hook);
|
||
|
||
/* The hook that points to the operation data. */
|
||
void *hook;
|
||
};
|
||
|
||
|
||
/* The context defines an environment in which crypto operations can
|
||
be performed (sequentially). */
|
||
struct gpgme_context_s
|
||
{
|
||
/* The protocol used by this context. */
|
||
GpgmeProtocol protocol;
|
||
|
||
/* The running engine process. */
|
||
EngineObject engine;
|
||
|
||
/* True if armor mode should be used. */
|
||
unsigned int use_armor : 1;
|
||
|
||
/* True if text mode should be used. */
|
||
unsigned int use_textmode : 1;
|
||
|
||
/* Flags for keylist mode. */
|
||
unsigned int keylist_mode;
|
||
|
||
/* Number of certs to be included. */
|
||
unsigned int include_certs;
|
||
|
||
/* The number of keys in signers. */
|
||
unsigned int signers_len;
|
||
|
||
/* Size of the following array. */
|
||
unsigned int signers_size;
|
||
GpgmeKey *signers;
|
||
|
||
/* The operation data hooked into the context. */
|
||
struct ctx_op_data *op_data;
|
||
|
||
/* Last operation info. */
|
||
GpgmeData op_info;
|
||
|
||
/* The user provided passphrase callback and its hook value. */
|
||
GpgmePassphraseCb passphrase_cb;
|
||
void *passphrase_cb_value;
|
||
|
||
/* The user provided progress callback and its hook value. */
|
||
GpgmeProgressCb progress_cb;
|
||
void *progress_cb_value;
|
||
|
||
/* A list of file descriptors in active use by the current
|
||
operation. */
|
||
struct fd_table fdt;
|
||
struct GpgmeIOCbs io_cbs;
|
||
};
|
||
|
||
|
||
/* A recipient is defined by a user ID, but we define it as an opaque
|
||
type for the user. */
|
||
struct gpgme_recipients_s
|
||
{
|
||
GpgmeUserID list;
|
||
};
|
||
|
||
#endif /* CONTEXT_H */
|