2003-05-18 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_object_s;
27 typedef struct engine_object_s *EngineObject;
28
29 typedef gpgme_error_t (*EngineStatusHandler) (void *priv, gpgme_status_code_t code,
30                                            char *args);
31 typedef gpgme_error_t (*EngineColonLineHandler) (void *priv, char *line);
32 typedef gpgme_error_t (*EngineCommandHandler) (void *priv, gpgme_status_code_t code,
33                                             const char *keyword,
34                                             const char **result);
35
36 gpgme_error_t _gpgme_engine_new (gpgme_protocol_t proto, EngineObject *r_engine);
37 void _gpgme_engine_release (EngineObject engine);
38 void _gpgme_engine_set_status_handler (EngineObject engine,
39                                        EngineStatusHandler fnc,
40                                        void *fnc_value);
41 gpgme_error_t _gpgme_engine_set_command_handler (EngineObject engine,
42                                               EngineCommandHandler fnc,
43                                               void *fnc_value,
44                                               gpgme_data_t data);
45 gpgme_error_t _gpgme_engine_set_colon_line_handler (EngineObject engine,
46                                                  EngineColonLineHandler fnc,
47                                                  void *fnc_value);
48 gpgme_error_t _gpgme_engine_op_decrypt (EngineObject engine, gpgme_data_t ciph,
49                                      gpgme_data_t plain);
50 gpgme_error_t _gpgme_engine_op_delete (EngineObject engine, gpgme_key_t key,
51                                     int allow_secret);
52 gpgme_error_t _gpgme_engine_op_edit (EngineObject engine, gpgme_key_t key,
53                                   gpgme_data_t out, gpgme_ctx_t ctx /* FIXME */);
54 gpgme_error_t _gpgme_engine_op_encrypt (EngineObject engine, gpgme_recipients_t recp,
55                                      gpgme_data_t plain, gpgme_data_t ciph,
56                                      int use_armor);
57 gpgme_error_t _gpgme_engine_op_encrypt_sign (EngineObject engine,
58                                           gpgme_recipients_t recp,
59                                           gpgme_data_t plain, gpgme_data_t ciph,
60                                           int use_armor,
61                                           gpgme_ctx_t ctx /* FIXME */);
62 gpgme_error_t _gpgme_engine_op_export (EngineObject engine, gpgme_recipients_t recp,
63                                     gpgme_data_t keydata, int use_armor);
64 gpgme_error_t _gpgme_engine_op_genkey (EngineObject engine, gpgme_data_t help_data,
65                                     int use_armor, gpgme_data_t pubkey,
66                                     gpgme_data_t seckey);
67 gpgme_error_t _gpgme_engine_op_import (EngineObject engine, gpgme_data_t keydata);
68 gpgme_error_t _gpgme_engine_op_keylist (EngineObject engine, const char *pattern,
69                                      int secret_only,
70                                      int keylist_mode);
71 gpgme_error_t _gpgme_engine_op_keylist_ext (EngineObject engine,
72                                          const char *pattern[],
73                                          int secret_only,
74                                          int reserved,
75                                          int keylist_mode);
76 gpgme_error_t _gpgme_engine_op_sign (EngineObject engine, gpgme_data_t in,
77                                   gpgme_data_t out, gpgme_sig_mode_t mode,
78                                   int use_armor, int use_textmode,
79                                   int include_certs,
80                                   gpgme_ctx_t ctx /* FIXME */);
81 gpgme_error_t _gpgme_engine_op_trustlist (EngineObject engine,
82                                        const char *pattern);
83 gpgme_error_t _gpgme_engine_op_verify (EngineObject engine, gpgme_data_t sig,
84                                     gpgme_data_t signed_text,
85                                     gpgme_data_t plaintext);
86
87 void _gpgme_engine_set_io_cbs (EngineObject engine,
88                                gpgme_io_cbs_t io_cbs);
89 void _gpgme_engine_io_event (EngineObject engine,
90                              gpgme_event_io_t type, void *type_data);
91
92 #endif /* ENGINE_H */