2010-11-17 Marcus Brinkmann <mb@g10code.com>
[gpgme.git] / src / ops.h
1 /* ops.h - Internal operation support.
2    Copyright (C) 2000 Werner Koch (dd9jn)
3    Copyright (C) 2001, 2002, 2003, 2004, 2005 g10 Code GmbH
4  
5    This file is part of GPGME.
6  
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.
11    
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.
16    
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
20    02111-1307, USA.  */
21
22 #ifndef OPS_H
23 #define OPS_H
24
25 #include "gpgme.h"
26 #include "context.h"
27
28 \f
29 /* From gpgme.c.  */
30 gpgme_error_t _gpgme_cancel_with_err (gpgme_ctx_t ctx, gpg_error_t ctx_err,
31                                       gpg_error_t op_err);
32 /* Clear all notation data from the context.  */
33 void _gpgme_sig_notation_clear (gpgme_ctx_t ctx);
34
35 void _gpgme_release_result (gpgme_ctx_t ctx);
36
37 \f
38 /* From wait.c.  */
39 gpgme_error_t _gpgme_wait_one (gpgme_ctx_t ctx);
40 gpgme_error_t _gpgme_wait_one_ext (gpgme_ctx_t ctx, gpgme_error_t *op_err);
41 gpgme_error_t _gpgme_wait_on_condition (gpgme_ctx_t ctx, volatile int *cond,
42                                         gpgme_error_t *op_err);
43
44 \f
45 /* From data.c.  */
46 gpgme_error_t _gpgme_data_inbound_handler (void *opaque, int fd);
47 gpgme_error_t _gpgme_data_outbound_handler (void *opaque, int fd);
48
49 \f
50 /* From op-support.c.  */
51
52 /* Find or create the op data object of type TYPE.  */
53 gpgme_error_t _gpgme_op_data_lookup (gpgme_ctx_t ctx, ctx_op_data_id_t type,
54                                      void **hook, int size,
55                                      void (*cleanup) (void *));
56
57 /* Prepare a new operation on CTX.  */
58 gpgme_error_t _gpgme_op_reset (gpgme_ctx_t ctx, int synchronous);
59
60 /* Parse the INV_RECP status line in ARGS and return the result in
61    KEY.  */
62 gpgme_error_t _gpgme_parse_inv_recp (char *args, gpgme_invalid_key_t *key);
63
64 /* Parse the PLAINTEXT status line in ARGS and return the result in
65    FILENAMEP.  */
66 gpgme_error_t _gpgme_parse_plaintext (char *args, char **filenamep);
67
68
69 \f
70 /* From verify.c.  */
71 gpgme_error_t _gpgme_op_verify_init_result (gpgme_ctx_t ctx);
72 gpgme_error_t _gpgme_verify_status_handler (void *priv,
73                                             gpgme_status_code_t code,
74                                             char *args);
75
76 \f
77 /* From decrypt.c.  */
78 gpgme_error_t _gpgme_op_decrypt_init_result (gpgme_ctx_t ctx);
79 gpgme_error_t _gpgme_decrypt_status_handler (void *priv,
80                                              gpgme_status_code_t code,
81                                              char *args);
82
83 \f
84 /* From signers.c.  */
85 void _gpgme_signers_clear (gpgme_ctx_t ctx);
86
87 /* From sign.c.  */
88
89 /* Create an initial op data object for signing.  Needs to be called
90    once before calling _gpgme_sign_status_handler.  */
91 gpgme_error_t _gpgme_op_sign_init_result (gpgme_ctx_t ctx);
92
93 /* Process a status line for signing operations.  */
94 gpgme_error_t _gpgme_sign_status_handler (void *priv,
95                                           gpgme_status_code_t code,
96                                           char *args);
97
98 \f
99 /* From encrypt.c.  */
100
101 /* Create an initial op data object for encrypt.  Needs to be called
102    once before calling _gpgme_encrypt_status_handler.  */
103 gpgme_error_t _gpgme_op_encrypt_init_result (gpgme_ctx_t ctx);
104
105 /* Process a status line for encryption operations.  */
106 gpgme_error_t _gpgme_encrypt_status_handler (void *priv,
107                                              gpgme_status_code_t code,
108                                              char *args);
109
110 \f
111 /* From passphrase.c.  */
112 gpgme_error_t _gpgme_passphrase_status_handler (void *priv,
113                                                 gpgme_status_code_t code,
114                                                 char *args);
115 gpgme_error_t _gpgme_passphrase_command_handler (void *opaque,
116                                                  gpgme_status_code_t code,
117                                                  const char *key, int fd,
118                                                  int *processed);
119
120 \f
121 /* From progress.c.  */
122 gpgme_error_t _gpgme_progress_status_handler (void *priv,
123                                               gpgme_status_code_t code,
124                                               char *args);
125
126 \f
127 /* From key.c.  */
128 gpgme_error_t _gpgme_key_new (gpgme_key_t *r_key);
129 gpgme_error_t _gpgme_key_add_subkey (gpgme_key_t key,
130                                      gpgme_subkey_t *r_subkey);
131 gpgme_error_t _gpgme_key_append_name (gpgme_key_t key, const char *src, int convert);
132 gpgme_key_sig_t _gpgme_key_add_sig (gpgme_key_t key, char *src);
133
134 \f
135 /* From keylist.c.  */
136 void _gpgme_op_keylist_event_cb (void *data, gpgme_event_io_t type,
137                                  void *type_data);
138
139 \f
140 /* From trust-item.c.  */
141
142 /* Create a new trust item.  */
143 gpgme_error_t _gpgme_trust_item_new (gpgme_trust_item_t *r_item);
144
145 \f
146 /* From trustlist.c.  */
147 void _gpgme_op_trustlist_event_cb (void *data, gpgme_event_io_t type,
148                                    void *type_data);
149
150 \f
151 /* From version.c.  */
152
153 /* Return true if MY_VERSION is at least REQ_VERSION, and false
154    otherwise.  */
155 int _gpgme_compare_versions (const char *my_version,
156                              const char *req_version);
157 char *_gpgme_get_program_version (const char *const path);
158
159 \f
160 /* From sig-notation.c.  */
161
162 /* Create a new, empty signature notation data object.  */
163 gpgme_error_t _gpgme_sig_notation_create (gpgme_sig_notation_t *notationp,
164                                           const char *name, int name_len,
165                                           const char *value, int value_len,
166                                           gpgme_sig_notation_flags_t flags);
167
168 /* Free the signature notation object and all associated resources.
169    The object must already be removed from any linked list as the next
170    pointer is ignored.  */
171 void _gpgme_sig_notation_free (gpgme_sig_notation_t notation);
172
173 /* Parse a notation or policy URL subpacket.  If the packet type is
174    not known, return no error but NULL in NOTATION.  */
175 gpgme_error_t _gpgme_parse_notation (gpgme_sig_notation_t *notationp,
176                                      int type, int pkflags, int len,
177                                      char *data);
178
179 #endif /* OPS_H */