* gpgsm/t-encrypt.c (main): Add a simple option parser and allow
[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 } GpgStatusCode;
107
108 typedef void (*GpgStatusHandler)( GpgmeCtx, GpgStatusCode code, char *args ); 
109 typedef void (*GpgColonLineHandler)( GpgmeCtx, char *line ); 
110 typedef const char *(*GpgCommandHandler)(void*, GpgStatusCode code,
111                                          const char *keyword);
112
113 const char *_gpgme_gpg_get_version (void);
114 GpgmeError _gpgme_gpg_check_version (void);
115
116 GpgmeError _gpgme_gpg_new ( GpgObject *r_gpg );
117 void       _gpgme_gpg_release ( GpgObject gpg );
118 void       _gpgme_gpg_housecleaning (void);
119 void       _gpgme_gpg_enable_pipemode ( GpgObject gpg );
120 GpgmeError _gpgme_gpg_add_arg ( GpgObject gpg, const char *arg );
121 GpgmeError _gpgme_gpg_add_data ( GpgObject gpg, GpgmeData data, int dup_to );
122 GpgmeError _gpgme_gpg_add_pm_data ( GpgObject gpg, GpgmeData data, int what );
123 void       _gpgme_gpg_set_status_handler ( GpgObject gpg,
124                                            GpgStatusHandler fnc,
125                                            void *fnc_value );
126 GpgmeError _gpgme_gpg_set_colon_line_handler ( GpgObject gpg,
127                                                GpgColonLineHandler fnc,
128                                                void *fnc_value );
129 GpgmeError _gpgme_gpg_set_simple_line_handler ( GpgObject gpg,
130                                                 GpgColonLineHandler fnc,
131                                                 void *fnc_value );
132 GpgmeError _gpgme_gpg_set_command_handler ( GpgObject gpg,
133                                             GpgCommandHandler fnc,
134                                             void *fnc_value );
135
136 GpgmeError _gpgme_gpg_op_decrypt (GpgObject gpg, GpgmeData ciph,
137                                   GpgmeData plain);
138 GpgmeError _gpgme_gpg_op_delete (GpgObject gpg, GpgmeKey key, int allow_secret);
139 GpgmeError _gpgme_gpg_op_encrypt (GpgObject gpg, GpgmeRecipients recp,
140                                   GpgmeData plain, GpgmeData ciph,
141                                   int use_armor);
142 GpgmeError _gpgme_gpg_op_encrypt_sign (GpgObject gpg, GpgmeRecipients recp,
143                                        GpgmeData plain, GpgmeData ciph,
144                                        int use_armor, GpgmeCtx ctx);
145 GpgmeError _gpgme_gpg_op_export (GpgObject gpg, GpgmeRecipients recp,
146                                  GpgmeData keydata, int use_armor);
147 GpgmeError _gpgme_gpg_op_genkey (GpgObject gpg, GpgmeData help_data,
148                                  int use_armor, GpgmeData pubkey,
149                                  GpgmeData seckey);
150 GpgmeError _gpgme_gpg_op_import (GpgObject gpg, GpgmeData keydata);
151 GpgmeError _gpgme_gpg_op_keylist (GpgObject gpg, const char *pattern,
152                                   int secret_only, int keylist_mode);
153 GpgmeError _gpgme_gpg_op_keylist_ext (GpgObject gpg, const char *pattern[],
154                                       int secret_only, int reserved,
155                                       int keylist_mode);
156 GpgmeError _gpgme_gpg_op_sign (GpgObject gpg, GpgmeData in, GpgmeData out,
157                                GpgmeSigMode mode, int use_armor,
158                                int use_textmode, GpgmeCtx ctx /* FIXME */);
159 GpgmeError _gpgme_gpg_op_trustlist (GpgObject gpg, const char *pattern);
160 GpgmeError _gpgme_gpg_op_verify (GpgObject gpg, GpgmeData sig, GpgmeData text);
161 GpgmeError _gpgme_gpg_spawn (GpgObject gpg, void *opaque);
162
163 #endif /* RUNGPG_H */