2003-10-02 Marcus Brinkmann <marcus@g10code.de>
[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                                  const char *lc_ctype,
41                                  const char *lc_messages);
42 void _gpgme_engine_release (engine_t engine);
43 void _gpgme_engine_set_status_handler (engine_t engine,
44                                        engine_status_handler_t fnc,
45                                        void *fnc_value);
46 gpgme_error_t _gpgme_engine_set_command_handler (engine_t engine,
47                                                  engine_command_handler_t fnc,
48                                                  void *fnc_value,
49                                                  gpgme_data_t data);
50 gpgme_error_t
51 _gpgme_engine_set_colon_line_handler (engine_t engine,
52                                       engine_colon_line_handler_t fnc,
53                                       void *fnc_value);
54 gpgme_error_t _gpgme_engine_op_decrypt (engine_t engine,
55                                         gpgme_data_t ciph,
56                                         gpgme_data_t plain);
57 gpgme_error_t _gpgme_engine_op_delete (engine_t engine, gpgme_key_t key,
58                                        int allow_secret);
59 gpgme_error_t _gpgme_engine_op_edit (engine_t engine, int type,
60                                      gpgme_key_t key, gpgme_data_t out,
61                                      gpgme_ctx_t ctx /* FIXME */);
62 gpgme_error_t _gpgme_engine_op_encrypt (engine_t engine,
63                                         gpgme_key_t recp[],
64                                         gpgme_encrypt_flags_t flags,
65                                         gpgme_data_t plain, gpgme_data_t ciph,
66                                         int use_armor);
67 gpgme_error_t _gpgme_engine_op_encrypt_sign (engine_t engine,
68                                              gpgme_key_t recp[],
69                                              gpgme_encrypt_flags_t flags,
70                                              gpgme_data_t plain,
71                                              gpgme_data_t ciph,
72                                              int use_armor,
73                                              gpgme_ctx_t ctx /* FIXME */);
74 gpgme_error_t _gpgme_engine_op_export (engine_t engine, const char *pattern,
75                                        unsigned int reserved,
76                                        gpgme_data_t keydata, int use_armor);
77 gpgme_error_t _gpgme_engine_op_export_ext (engine_t engine,
78                                            const char *pattern[],
79                                            unsigned int reserved,
80                                            gpgme_data_t keydata,
81                                            int use_armor);
82 gpgme_error_t _gpgme_engine_op_genkey (engine_t engine,
83                                        gpgme_data_t help_data,
84                                        int use_armor, gpgme_data_t pubkey,
85                                        gpgme_data_t seckey);
86 gpgme_error_t _gpgme_engine_op_import (engine_t engine,
87                                        gpgme_data_t keydata);
88 gpgme_error_t _gpgme_engine_op_keylist (engine_t engine,
89                                         const char *pattern,
90                                         int secret_only,
91                                         gpgme_keylist_mode_t mode);
92 gpgme_error_t _gpgme_engine_op_keylist_ext (engine_t engine,
93                                             const char *pattern[],
94                                             int secret_only,
95                                             int reserved,
96                                             gpgme_keylist_mode_t mode);
97 gpgme_error_t _gpgme_engine_op_sign (engine_t engine, gpgme_data_t in,
98                                      gpgme_data_t out, gpgme_sig_mode_t mode,
99                                      int use_armor, int use_textmode,
100                                      int include_certs,
101                                      gpgme_ctx_t ctx /* FIXME */);
102 gpgme_error_t _gpgme_engine_op_trustlist (engine_t engine,
103                                           const char *pattern);
104 gpgme_error_t _gpgme_engine_op_verify (engine_t engine, gpgme_data_t sig,
105                                        gpgme_data_t signed_text,
106                                        gpgme_data_t plaintext);
107
108 void _gpgme_engine_set_io_cbs (engine_t engine,
109                                gpgme_io_cbs_t io_cbs);
110 void _gpgme_engine_io_event (engine_t engine,
111                              gpgme_event_io_t type, void *type_data);
112
113 #endif /* ENGINE_H */