a798caf32083ce73593cd9822f77f0229d08097e
[gpgme.git] / gpgme / rungpg.h
1 /* rungpg.h -  gpg calling functions
2  *      Copyright (C) 2000 Werner Koch (dd9jn)
3  *      Copyright (C) 2001 g10 Code GmbH
4  *
5  * This file is part of GPGME.
6  *
7  * GPGME is free software; you can redistribute it and/or modify
8  * it 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,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
20  */
21
22 #ifndef RUNGPG_H
23 #define RUNGPG_H
24
25 #include "types.h"
26
27
28 typedef enum  {
29     STATUS_EOF ,
30     /* mkstatus starts here */
31     STATUS_ENTER              , 
32     STATUS_LEAVE              ,
33     STATUS_ABORT              ,
34
35     STATUS_GOODSIG            ,
36     STATUS_BADSIG             ,
37     STATUS_ERRSIG             ,
38
39
40     STATUS_BADARMOR           ,
41
42     STATUS_RSA_OR_IDEA        ,
43     STATUS_KEYEXPIRED         ,
44     STATUS_KEYREVOKED         ,
45
46     STATUS_TRUST_UNDEFINED    ,
47     STATUS_TRUST_NEVER        ,
48     STATUS_TRUST_MARGINAL     ,
49     STATUS_TRUST_FULLY        ,
50     STATUS_TRUST_ULTIMATE     ,
51
52     STATUS_SHM_INFO           ,
53     STATUS_SHM_GET            ,
54     STATUS_SHM_GET_BOOL       ,
55     STATUS_SHM_GET_HIDDEN     ,
56
57     STATUS_NEED_PASSPHRASE    ,
58     STATUS_VALIDSIG           ,
59     STATUS_SIG_ID             ,
60     STATUS_ENC_TO             ,
61     STATUS_NODATA             ,
62     STATUS_BAD_PASSPHRASE     ,
63     STATUS_NO_PUBKEY          ,
64     STATUS_NO_SECKEY          ,
65     STATUS_NEED_PASSPHRASE_SYM,
66     STATUS_DECRYPTION_FAILED  ,
67     STATUS_DECRYPTION_OKAY    ,
68     STATUS_MISSING_PASSPHRASE ,
69     STATUS_GOOD_PASSPHRASE    ,
70     STATUS_GOODMDC            ,
71     STATUS_BADMDC             ,
72     STATUS_ERRMDC             ,
73     STATUS_IMPORTED           ,
74     STATUS_IMPORT_RES         ,
75     STATUS_FILE_START         ,
76     STATUS_FILE_DONE          ,
77     STATUS_FILE_ERROR         ,
78
79     STATUS_BEGIN_DECRYPTION   ,
80     STATUS_END_DECRYPTION     ,
81     STATUS_BEGIN_ENCRYPTION   ,
82     STATUS_END_ENCRYPTION     ,
83
84     STATUS_DELETE_PROBLEM     ,
85     STATUS_GET_BOOL           ,
86     STATUS_GET_LINE           ,
87     STATUS_GET_HIDDEN         ,
88     STATUS_GOT_IT             ,
89     STATUS_PROGRESS           ,
90     STATUS_SIG_CREATED        ,
91     STATUS_SESSION_KEY        ,
92     STATUS_NOTATION_NAME      ,
93     STATUS_NOTATION_DATA      ,
94     STATUS_POLICY_URL         ,
95     STATUS_BEGIN_STREAM       ,
96     STATUS_END_STREAM         ,
97     STATUS_KEY_CREATED        ,
98     STATUS_USERID_HINT        ,
99     STATUS_UNEXPECTED         ,
100     STATUS_INV_RECP           ,
101     STATUS_NO_RECP            ,
102     STATUS_ALREADY_SIGNED     ,
103     STATUS_SIGEXPIRED         ,
104     STATUS_EXPSIG             ,
105     STATUS_EXPKEYSIG          ,
106     STATUS_TRUNCATED          ,
107     STATUS_ERROR              ,
108 } GpgStatusCode;
109
110 typedef void (*GpgStatusHandler)( GpgmeCtx, GpgStatusCode code, char *args ); 
111 typedef void (*GpgColonLineHandler)( GpgmeCtx, char *line ); 
112 typedef const char *(*GpgCommandHandler)(void*, GpgStatusCode code,
113                                          const char *keyword);
114
115 const char *_gpgme_gpg_get_version (void);
116 GpgmeError _gpgme_gpg_check_version (void);
117
118 GpgmeError _gpgme_gpg_new ( GpgObject *r_gpg );
119 void       _gpgme_gpg_release ( GpgObject gpg );
120 void       _gpgme_gpg_housecleaning (void);
121 void       _gpgme_gpg_enable_pipemode ( GpgObject gpg );
122 GpgmeError _gpgme_gpg_add_arg ( GpgObject gpg, const char *arg );
123 GpgmeError _gpgme_gpg_add_data ( GpgObject gpg, GpgmeData data, int dup_to );
124 GpgmeError _gpgme_gpg_add_pm_data ( GpgObject gpg, GpgmeData data, int what );
125 void       _gpgme_gpg_set_status_handler ( GpgObject gpg,
126                                            GpgStatusHandler fnc,
127                                            void *fnc_value );
128 GpgmeError _gpgme_gpg_set_colon_line_handler ( GpgObject gpg,
129                                                GpgColonLineHandler fnc,
130                                                void *fnc_value );
131 GpgmeError _gpgme_gpg_set_simple_line_handler ( GpgObject gpg,
132                                                 GpgColonLineHandler fnc,
133                                                 void *fnc_value );
134 GpgmeError _gpgme_gpg_set_command_handler ( GpgObject gpg,
135                                             GpgCommandHandler fnc,
136                                             void *fnc_value );
137
138 GpgmeError _gpgme_gpg_op_decrypt (GpgObject gpg, GpgmeData ciph,
139                                   GpgmeData plain);
140 GpgmeError _gpgme_gpg_op_delete (GpgObject gpg, GpgmeKey key, int allow_secret);
141 GpgmeError _gpgme_gpg_op_encrypt (GpgObject gpg, GpgmeRecipients recp,
142                                   GpgmeData plain, GpgmeData ciph,
143                                   int use_armor);
144 GpgmeError _gpgme_gpg_op_encrypt_sign (GpgObject gpg, GpgmeRecipients recp,
145                                        GpgmeData plain, GpgmeData ciph,
146                                        int use_armor, GpgmeCtx ctx);
147 GpgmeError _gpgme_gpg_op_export (GpgObject gpg, GpgmeRecipients recp,
148                                  GpgmeData keydata, int use_armor);
149 GpgmeError _gpgme_gpg_op_genkey (GpgObject gpg, GpgmeData help_data,
150                                  int use_armor, GpgmeData pubkey,
151                                  GpgmeData seckey);
152 GpgmeError _gpgme_gpg_op_import (GpgObject gpg, GpgmeData keydata);
153 GpgmeError _gpgme_gpg_op_keylist (GpgObject gpg, const char *pattern,
154                                   int secret_only, int keylist_mode);
155 GpgmeError _gpgme_gpg_op_keylist_ext (GpgObject gpg, const char *pattern[],
156                                       int secret_only, int reserved,
157                                       int keylist_mode);
158 GpgmeError _gpgme_gpg_op_sign (GpgObject gpg, GpgmeData in, GpgmeData out,
159                                GpgmeSigMode mode, int use_armor,
160                                int use_textmode, GpgmeCtx ctx /* FIXME */);
161 GpgmeError _gpgme_gpg_op_trustlist (GpgObject gpg, const char *pattern);
162 GpgmeError _gpgme_gpg_op_verify (GpgObject gpg, GpgmeData sig, GpgmeData text);
163 GpgmeError _gpgme_gpg_spawn (GpgObject gpg, void *opaque);
164 void _gpgme_gpg_set_io_cbs (GpgObject gpg, struct GpgmeIOCbs *io_cbs);
165
166 #endif /* RUNGPG_H */