libkdenetwork Library API Documentation

libgpgme-copy/gpgme/context.h

00001 /* context.h - Definitions for a GPGME context.
00002    Copyright (C) 2000 Werner Koch (dd9jn)
00003    Copyright (C) 2001, 2002, 2003 g10 Code GmbH
00004 
00005    This file is part of GPGME.
00006  
00007    GPGME is free software; you can redistribute it and/or modify it
00008    under the terms of the GNU General Public License as published by
00009    the Free Software Foundation; either version 2 of the License, or
00010    (at your option) any later version.
00011  
00012    GPGME is distributed in the hope that it will be useful, but
00013    WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015    General Public License for more details.
00016  
00017    You should have received a copy of the GNU General Public License
00018    along with GPGME; if not, write to the Free Software Foundation,
00019    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
00020 
00021 #ifndef CONTEXT_H
00022 #define CONTEXT_H
00023 
00024 #include "gpgme.h"
00025 #include "engine.h"
00026 #include "wait.h"
00027 
00028 
00029 /* Operations might require to remember arbitrary information and data
00030    objects during invocations of the status handler.  The
00031    ctx_op_data structure provides a generic framework to hook in
00032    such additional data.  */
00033 typedef enum
00034   {
00035     OPDATA_DECRYPT, OPDATA_SIGN, OPDATA_ENCRYPT, OPDATA_PASSPHRASE,
00036     OPDATA_IMPORT, OPDATA_GENKEY, OPDATA_KEYLIST, OPDATA_EDIT,
00037     OPDATA_VERIFY, OPDATA_TRUSTLIST
00038   } ctx_op_data_id_t;
00039 
00040 
00041 struct ctx_op_data
00042 {
00043   /* The next element in the linked list, or NULL if this is the last
00044      element.  */
00045   struct ctx_op_data *next;
00046 
00047   /* The type of the hook data, which can be used by a routine to
00048      lookup the hook data.  */
00049   ctx_op_data_id_t type;
00050 
00051   /* The function to release HOOK and all its associated resources.
00052      Can be NULL if no special dealllocation routine is necessary.  */
00053   void (*cleanup) (void *hook);
00054 
00055   /* The hook that points to the operation data.  */
00056   void *hook;
00057 };
00058 typedef struct ctx_op_data *ctx_op_data_t;
00059 
00060 
00061 /* The context defines an environment in which crypto operations can
00062    be performed (sequentially).  */
00063 struct gpgme_context
00064 {
00065   /* The protocol used by this context.  */
00066   gpgme_protocol_t protocol;
00067 
00068   /* The running engine process.  */
00069   engine_t engine;
00070 
00071   /* True if armor mode should be used.  */
00072   unsigned int use_armor : 1;
00073 
00074   /* True if text mode should be used.  */
00075   unsigned int use_textmode : 1;
00076 
00077   /* Flags for keylist mode.  */
00078   gpgme_keylist_mode_t keylist_mode;
00079 
00080   /* Number of certs to be included.  */
00081   unsigned int include_certs;
00082 
00083   /* The number of keys in signers.  */
00084   unsigned int signers_len;
00085 
00086   /* Size of the following array.  */
00087   unsigned int signers_size;
00088   gpgme_key_t *signers;
00089 
00090   /* The locale for the pinentry.  */
00091   char *lc_ctype;
00092   char *lc_messages;
00093 
00094   /* The operation data hooked into the context.  */
00095   ctx_op_data_t op_data;
00096 
00097   /* The user provided passphrase callback and its hook value.  */
00098   gpgme_passphrase_cb_t passphrase_cb;
00099   void *passphrase_cb_value;
00100 
00101   /* The user provided progress callback and its hook value.  */
00102   gpgme_progress_cb_t progress_cb;
00103   void *progress_cb_value;
00104 
00105   /* A list of file descriptors in active use by the current
00106      operation.  */
00107   struct fd_table fdt;
00108   struct gpgme_io_cbs io_cbs;
00109 };
00110 
00111 #endif  /* CONTEXT_H */
KDE Logo
This file is part of the documentation for libkdenetwork Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu May 3 20:16:58 2007 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003