doc/
[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     STATUS_GOODSIG            ,
35     STATUS_BADSIG             ,
36     STATUS_ERRSIG             ,
37     STATUS_BADARMOR           ,
38     STATUS_RSA_OR_IDEA        ,
39     STATUS_SIGEXPIRED         ,
40     STATUS_KEYREVOKED         ,
41     STATUS_TRUST_UNDEFINED    ,
42     STATUS_TRUST_NEVER        ,
43     STATUS_TRUST_MARGINAL     ,
44     STATUS_TRUST_FULLY        ,
45     STATUS_TRUST_ULTIMATE     ,
46     STATUS_SHM_INFO           ,
47     STATUS_SHM_GET            ,
48     STATUS_SHM_GET_BOOL       ,
49     STATUS_SHM_GET_HIDDEN     ,
50     STATUS_NEED_PASSPHRASE    ,
51     STATUS_UNEXPECTED         ,
52     STATUS_VALIDSIG           ,
53     STATUS_SIG_ID             ,
54     STATUS_ENC_TO             ,
55     STATUS_NODATA             ,
56     STATUS_BAD_PASSPHRASE     ,
57     STATUS_NO_PUBKEY          ,
58     STATUS_NO_SECKEY          ,
59     STATUS_NEED_PASSPHRASE_SYM,
60     STATUS_DECRYPTION_FAILED  ,
61     STATUS_DECRYPTION_OKAY    ,
62     STATUS_MISSING_PASSPHRASE ,
63     STATUS_GOOD_PASSPHRASE    ,
64     STATUS_GOODMDC            ,
65     STATUS_BADMDC             ,
66     STATUS_ERRMDC             ,
67     STATUS_IMPORTED           ,
68     STATUS_IMPORT_RES         ,
69     STATUS_FILE_START         ,
70     STATUS_FILE_DONE          ,
71     STATUS_FILE_ERROR         ,
72     STATUS_BEGIN_DECRYPTION   ,
73     STATUS_END_DECRYPTION     ,
74     STATUS_BEGIN_ENCRYPTION   ,
75     STATUS_END_ENCRYPTION     ,
76     STATUS_DELETE_PROBLEM     ,
77     STATUS_GET_BOOL           ,
78     STATUS_GET_LINE           ,
79     STATUS_GET_HIDDEN         ,
80     STATUS_GOT_IT             ,
81     STATUS_PROGRESS           ,
82     STATUS_SIG_CREATED        ,
83     STATUS_KEY_CREATED        ,
84     STATUS_SESSION_KEY        ,
85     STATUS_NOTATION_NAME      ,
86     STATUS_NOTATION_DATA      ,
87     STATUS_USERID_HINT        ,
88     STATUS_POLICY_URL         ,
89     STATUS_BEGIN_STREAM       ,
90     STATUS_END_STREAM         ,
91     STATUS_INV_RECP           ,
92     STATUS_NO_RECP        
93 } GpgStatusCode;
94
95 typedef void (*GpgStatusHandler)( GpgmeCtx, GpgStatusCode code, char *args ); 
96 typedef void (*GpgColonLineHandler)( GpgmeCtx, char *line ); 
97 typedef const char *(*GpgCommandHandler)(void*, GpgStatusCode code,
98                                          const char *keyword);
99
100 const char *_gpgme_gpg_get_version (void);
101 GpgmeError _gpgme_gpg_check_version (void);
102
103 GpgmeError _gpgme_gpg_new ( GpgObject *r_gpg );
104 void       _gpgme_gpg_release ( GpgObject gpg );
105 void       _gpgme_gpg_housecleaning (void);
106 void       _gpgme_gpg_enable_pipemode ( GpgObject gpg );
107 GpgmeError _gpgme_gpg_add_arg ( GpgObject gpg, const char *arg );
108 GpgmeError _gpgme_gpg_add_data ( GpgObject gpg, GpgmeData data, int dup_to );
109 GpgmeError _gpgme_gpg_add_pm_data ( GpgObject gpg, GpgmeData data, int what );
110 void       _gpgme_gpg_set_status_handler ( GpgObject gpg,
111                                            GpgStatusHandler fnc,
112                                            void *fnc_value );
113 GpgmeError _gpgme_gpg_set_colon_line_handler ( GpgObject gpg,
114                                                GpgColonLineHandler fnc,
115                                                void *fnc_value );
116 GpgmeError _gpgme_gpg_set_simple_line_handler ( GpgObject gpg,
117                                                 GpgColonLineHandler fnc,
118                                                 void *fnc_value );
119 GpgmeError _gpgme_gpg_set_command_handler ( GpgObject gpg,
120                                             GpgCommandHandler fnc,
121                                             void *fnc_value );
122
123 GpgmeError _gpgme_gpg_op_decrypt (GpgObject gpg, GpgmeData ciph,
124                                   GpgmeData plain);
125 GpgmeError _gpgme_gpg_op_delete (GpgObject gpg, GpgmeKey key, int allow_secret);
126 GpgmeError _gpgme_gpg_op_encrypt (GpgObject gpg, GpgmeRecipients recp,
127                                   GpgmeData plain, GpgmeData ciph,
128                                   int use_armor);
129 GpgmeError _gpgme_gpg_op_encrypt_sign (GpgObject gpg, GpgmeRecipients recp,
130                                        GpgmeData plain, GpgmeData ciph,
131                                        int use_armor, GpgmeCtx ctx);
132 GpgmeError _gpgme_gpg_op_export (GpgObject gpg, GpgmeRecipients recp,
133                                  GpgmeData keydata, int use_armor);
134 GpgmeError _gpgme_gpg_op_genkey (GpgObject gpg, GpgmeData help_data,
135                                  int use_armor, GpgmeData pubkey,
136                                  GpgmeData seckey);
137 GpgmeError _gpgme_gpg_op_import (GpgObject gpg, GpgmeData keydata);
138 GpgmeError _gpgme_gpg_op_keylist (GpgObject gpg, const char *pattern,
139                                   int secret_only, int keylist_mode);
140 GpgmeError _gpgme_gpg_op_keylist_ext (GpgObject gpg, const char *pattern[],
141                                       int secret_only, int reserved,
142                                       int keylist_mode);
143 GpgmeError _gpgme_gpg_op_sign (GpgObject gpg, GpgmeData in, GpgmeData out,
144                                GpgmeSigMode mode, int use_armor,
145                                int use_textmode, GpgmeCtx ctx /* FIXME */);
146 GpgmeError _gpgme_gpg_op_trustlist (GpgObject gpg, const char *pattern);
147 GpgmeError _gpgme_gpg_op_verify (GpgObject gpg, GpgmeData sig, GpgmeData text);
148 GpgmeError _gpgme_gpg_spawn (GpgObject gpg, void *opaque);
149
150 #endif /* RUNGPG_H */