/[winpt]/trunk/w32gpgme/w32gpgme.h
ViewVC logotype

Annotation of /trunk/w32gpgme/w32gpgme.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 23 - (hide annotations)
Fri Sep 30 10:10:16 2005 UTC (19 years, 5 months ago) by twoaday
File MIME type: text/plain
File size: 5181 byte(s)
Almost finished phase 1 of the WinPT GPGME port.
Still need more cleanup, comments and tests.


1 twoaday 23 /* w32gpgme.h - W32 specific utility code for GPGME.
2     * Copyright (C) 2005 Timo Schulz
3     *
4     * This file is part of WinPT.
5     *
6     * WinPT is free software; you can redistribute it and/or modify
7     * it under the terms of the GNU General Public License as published by
8     * the Free Software Foundation; either version 2 of the License, or
9     * (at your option) any later version.
10     *
11     * WinPT is distributed in the hope that it will be useful,
12     * but WITHOUT ANY WARRANTY; without even the implied warranty of
13     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14     * GNU General Public License for more details.
15     *
16     * You should have received a copy of the GNU General Public License
17     * along with WinPT; if not, write to the Free Software Foundation,
18     * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
19     */
20    
21     #ifndef W32_GPGME_H
22     #define W32_GPGME_H
23    
24     #include "c:/oss/w32root/include/gpgme.h"
25    
26    
27    
28     struct keycache_s {
29     struct keycache_s * next;
30     int flags;
31     gpgme_key_t key;
32     struct keycache_s *pubpart;
33     struct {
34     unsigned int is_protected:1;
35     unsigned int divert_to_card:1;
36     unsigned int has_desig_rev:1;
37     } gloflags;
38     struct {
39     unsigned int used:1;
40     unsigned char *d;
41     unsigned int len;
42     } attrib;
43     unsigned char *sym_prefs;
44     };
45    
46     struct gpgme_keycache_s {
47     struct keycache_s *item;
48     struct keycache_s *tmp;
49     int secret;
50     int pos;
51     void (*cb) (void *, const char *, int, int, int);
52     void *cb_value;
53     int cb_value2;
54     };
55     typedef struct gpgme_keycache_s *gpgme_keycache_t;
56    
57     typedef enum {
58     PGP_MESSAGE = 1,
59     PGP_CLEARSIG = 2,
60     PGP_SIG = 4,
61     PGP_PUBKEY = 8,
62     PGP_SECKEY = 16,
63     PGP_DASH_ESCAPED = 32 /* actually not a type, just a flag */
64     } gpgme_pgptype_t;
65    
66    
67     gpgme_error_t gpg_data_new_from_clipboard (gpgme_data_t *r_dh, int wraplen);
68     void gpg_data_release_and_set_clipboard (gpgme_data_t dh, int chg_ver);
69     size_t gpg_data_readline (gpgme_data_t dh, char *line, size_t nbytes);
70    
71     gpgme_error_t gpg_data_release_and_set_file (gpgme_data_t dh, const char *fname);
72     gpgme_error_t gpg_data_mail_quote (gpgme_data_t *r_dh);
73     gpgme_error_t gpg_data_extract_plaintext (gpgme_data_t sig, gpgme_data_t *r_plain);
74    
75     /* Key caching */
76     gpgme_error_t gpgme_keycache_new (gpgme_keycache_t * r_ctx);
77     void gpgme_keycache_release (gpgme_keycache_t ctx);
78     void gpgme_keycache_set_cb (gpgme_keycache_t ctx,
79     void (*cb)(void *, const char *, int, int, int),
80     void * cb_value1, int cb_value2);
81     gpgme_error_t gpgme_keycache_add_key (gpgme_keycache_t ctx, gpgme_key_t key,
82     void **opaque);
83     gpgme_error_t gpgme_keycache_update_key (gpgme_keycache_t ctx, int is_sec,
84     void *opaque, const char *keyid);
85     gpgme_error_t gpgme_keycache_find_key (gpgme_keycache_t ctx, const char * pattern,
86     int flags, gpgme_key_t * r_key);
87     gpgme_error_t gpgme_keycache_find_key2 (gpgme_keycache_t ctx, const char *pattern, int flags,
88     gpgme_key_t *r_key, struct keycache_s **r_item);
89     gpgme_error_t gpgme_keycache_delete_key (gpgme_keycache_t ctx,
90     const char * pattern);
91     gpgme_error_t gpgme_keycache_init (gpgme_keycache_t ctx, const char * pattern,
92     int secret);
93     gpgme_error_t gpgme_keycache_next_key (gpgme_keycache_t ctx, int flags,
94     gpgme_key_t * r_key);
95     void gpgme_keycache_rewind( gpgme_keycache_t ctx );
96     int gpgme_keycache_count( gpgme_keycache_t ctx );
97     gpgme_error_t gpgme_keycache_prepare (gpgme_keycache_t ctx,
98     const char *pubring, const char * secring);
99     gpgme_error_t gpgme_keycache_prepare_single (gpgme_keycache_t ctx,
100     const char *keyid,
101     const char *pubr,
102     const char *secr);
103     gpgme_error_t gpgme_keycache_sync (gpgme_keycache_t pub, gpgme_keycache_t sec);
104     int gpgme_getkey_bykeyid (void *fd_handle, const char * keyid, gpgme_key_t *r_key);
105    
106     /* XXX */
107     gpgme_error_t
108     _gpgme_keycache_find_key2 (gpgme_keycache_t ctx, const char *pattern, int flags,
109     gpgme_key_t *r_key, struct keycache_s **r_item);
110    
111     /* Clipboard interface */
112     gpgme_error_t gpgme_clip_istext_avail (int *r_rc);
113     gpgme_error_t gpgme_clip_is_secured (gpgme_pgptype_t *r_type, int *r_rc);
114     gpgme_error_t gpgme_clip_get_pgptype (gpgme_pgptype_t *r_type);
115     gpgme_error_t gpgme_clip_parse_pgpid (const char *data, gpgme_pgptype_t *r_type);
116     gpgme_error_t gpgme_clip_do_check (int *r_rc);
117    
118     /*-- util.c --*/
119     gpgme_error_t gpg_rebuild_cache (void);
120     gpgme_error_t gpg_get_version (char **inf);
121     void gpg_set_debug_mode (int val);
122     gpgme_error_t gpg_export_seckey (const char *keyid, const char *outfile);
123     gpgme_error_t gpg_manage_ownertrust (char **data, int export);
124    
125     /* helpers */
126     char* strsep (char **stringp, const char *delim);
127     const char *stristr (const char *buf, const char *sub);
128    
129     struct file_data_s {
130     gpgme_data_cbs_t cbs;
131     FILE *handle;
132     gpgme_data_t dat;
133     };
134     typedef struct file_data_s *file_data_t;
135    
136     gpgme_error_t gpg_file_data_new (const char *fname, file_data_t *r_cb, int for_read);
137     void gpg_file_data_release (file_data_t cb);
138    
139     #endif /*W32_GPGME_H*/

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26