doc/
[gpgme.git] / gpgme / engine.h
1 /* engine.h -  GPGME engine interface.
2    Copyright (C) 2000 Werner Koch (dd9jn)
3    Copyright (C) 2001, 2002, 2003 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 General Public License as published by
9    the Free Software Foundation; either version 2 of the License, or
10    (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    General Public License for more details.
16  
17    You should have received a copy of the GNU General Public License
18    along with GPGME; if not, write to the Free Software Foundation,
19    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
20
21 #ifndef ENGINE_H
22 #define ENGINE_H
23
24 #include "gpgme.h"
25  
26 struct engine;
27 typedef struct engine *engine_t;
28
29 typedef gpgme_error_t (*engine_status_handler_t) (void *priv,
30                                                   gpgme_status_code_t code,
31                                                   char *args);
32 typedef gpgme_error_t (*engine_colon_line_handler_t) (void *priv, char *line);
33 typedef gpgme_error_t (*engine_command_handler_t) (void *priv,
34                                                    gpgme_status_code_t code,
35                                                    const char *keyword,
36                                                    int fd);
37
38 gpgme_error_t _gpgme_engine_new (gpgme_protocol_t proto,
39                                  engine_t *r_engine);
40 void _gpgme_engine_release (engine_t engine);
41 void _gpgme_engine_set_status_handler (engine_t engine,
42                                        engine_status_handler_t fnc,
43                                        void *fnc_value);
44 gpgme_error_t _gpgme_engine_set_command_handler (engine_t engine,
45                                                  engine_command_handler_t fnc,
46                                                  void *fnc_value,
47                                                  gpgme_data_t data);
48 gpgme_error_t
49 _gpgme_engine_set_colon_line_handler (engine_t engine,
50                                       engine_colon_line_handler_t fnc,
51                                       void *fnc_value);
52 gpgme_error_t _gpgme_engine_op_decrypt (engine_t engine,
53                                         gpgme_data_t ciph,
54                                         gpgme_data_t plain);
55 gpgme_error_t _gpgme_engine_op_delete (engine_t engine, gpgme_key_t key,
56                                        int allow_secret);
57 gpgme_error_t _gpgme_engine_op_edit (engine_t engine, gpgme_key_t key,
58                                      gpgme_data_t out,
59                                      gpgme_ctx_t ctx /* FIXME */);
60 gpgme_error_t _gpgme_engine_op_encrypt (engine_t engine,
61                                         gpgme_key_t recp[],
62                                         gpgme_encrypt_flags_t flags,
63                                         gpgme_data_t plain, gpgme_data_t ciph,
64                                         int use_armor);
65 gpgme_error_t _gpgme_engine_op_encrypt_sign (engine_t engine,
66                                              gpgme_key_t recp[],
67                                              gpgme_encrypt_flags_t flags,
68                                              gpgme_data_t plain,
69                                              gpgme_data_t ciph,
70                                              int use_armor,
71                                              gpgme_ctx_t ctx /* FIXME */);
72 gpgme_error_t _gpgme_engine_op_export (engine_t engine, const char *pattern,
73                                        unsigned int reserved,
74                                        gpgme_data_t keydata, int use_armor);
75 gpgme_error_t _gpgme_engine_op_export_ext (engine_t engine,
76                                            const char *pattern[],
77                                            unsigned int reserved,
78                                            gpgme_data_t keydata,
79                                            int use_armor);
80 gpgme_error_t _gpgme_engine_op_genkey (engine_t engine,
81                                        gpgme_data_t help_data,
82                                        int use_armor, gpgme_data_t pubkey,
83                                        gpgme_data_t seckey);
84 gpgme_error_t _gpgme_engine_op_import (engine_t engine,
85                                        gpgme_data_t keydata);
86 gpgme_error_t _gpgme_engine_op_keylist (engine_t engine,
87                                         const char *pattern,
88                                         int secret_only,
89                                         gpgme_keylist_mode_t mode);
90 gpgme_error_t _gpgme_engine_op_keylist_ext (engine_t engine,
91                                             const char *pattern[],
92                                             int secret_only,
93                                             int reserved,
94                                             gpgme_keylist_mode_t mode);
95 gpgme_error_t _gpgme_engine_op_sign (engine_t engine, gpgme_data_t in,
96                                      gpgme_data_t out, gpgme_sig_mode_t mode,
97                                      int use_armor, int use_textmode,
98                                      int include_certs,
99                                      gpgme_ctx_t ctx /* FIXME */);
100 gpgme_error_t _gpgme_engine_op_trustlist (engine_t engine,
101                                           const char *pattern);
102 gpgme_error_t _gpgme_engine_op_verify (engine_t engine, gpgme_data_t sig,
103                                        gpgme_data_t signed_text,
104                                        gpgme_data_t plaintext);
105
106 void _gpgme_engine_set_io_cbs (engine_t engine,
107                                gpgme_io_cbs_t io_cbs);
108 void _gpgme_engine_io_event (engine_t engine,
109                              gpgme_event_io_t type, void *type_data);
110
111 #endif /* ENGINE_H */