1 use libc::{c_char, c_int, c_long, c_uint, c_ulong, c_ushort, c_void, size_t, ssize_t};
2 
3 use crate::consts::*;
4 
5 pub use libgpg_error_sys::{
6     gpg_err_code_t as gpgme_err_code_t, gpg_err_source_t as gpgme_err_source_t,
7     gpg_error_t as gpgme_error_t,
8 };
9 
10 #[cfg(all(target_os = "windows", target_arch = "x86"))]
11 pub type gpgme_off_t = i32;
12 #[cfg(all(target_os = "windows", target_arch = "x86_64"))]
13 pub type gpgme_off_t = i64;
14 #[cfg(not(target_os = "windows"))]
15 pub type gpgme_off_t = libc::off_t;
16 
17 pub type gpgme_ssize_t = libc::ssize_t;
18 
19 // extern {
20 //     pub type gpgme_context;
21 //     pub type gpgme_data;
22 // }
23 #[repr(C)]
24 pub struct gpgme_context {
25     _priv: [u8; 0],
26 }
27 
28 #[repr(C)]
29 pub struct gpgme_data {
30     _priv: [u8; 0],
31 }
32 
33 pub type gpgme_ctx_t = *mut gpgme_context;
34 pub type gpgme_data_t = *mut gpgme_data;
35 
36 #[repr(C)]
37 #[derive(Copy, Clone)]
38 pub struct _gpgme_sig_notation {
39     pub next: gpgme_sig_notation_t,
40     pub name: *mut c_char,
41     pub value: *mut c_char,
42     pub name_len: c_int,
43     pub value_len: c_int,
44     pub flags: gpgme_sig_notation_flags_t,
45     pub bitfield: u32,
46 }
47 pub type gpgme_sig_notation_t = *mut _gpgme_sig_notation;
48 
49 impl _gpgme_sig_notation {
50     #[inline]
human_readable(&self) -> bool51     pub fn human_readable(&self) -> bool {
52         (self.bitfield & 0b01) == 0b01
53     }
54 
55     #[inline]
critical(&self) -> bool56     pub fn critical(&self) -> bool {
57         (self.bitfield & 0b10) == 0b10
58     }
59 }
60 
61 #[repr(C)]
62 #[derive(Copy, Clone)]
63 pub struct _gpgme_engine_info {
64     pub next: gpgme_engine_info_t,
65     pub protocol: gpgme_protocol_t,
66     pub file_name: *mut c_char,
67     pub version: *mut c_char,
68     pub req_version: *const c_char,
69     pub home_dir: *mut c_char,
70 }
71 pub type gpgme_engine_info_t = *mut _gpgme_engine_info;
72 
73 #[repr(C)]
74 #[derive(Copy, Clone)]
75 pub struct _gpgme_tofu_info {
76     pub next: gpgme_tofu_info_t,
77     pub bitfield: u32,
78     pub signcount: c_ushort,
79     pub encrcount: c_ushort,
80     pub signfirst: c_ulong,
81     pub signlast: c_ulong,
82     pub encrfirst: c_ulong,
83     pub encrlast: c_ulong,
84     pub description: *mut c_char,
85 }
86 pub type gpgme_tofu_info_t = *mut _gpgme_tofu_info;
87 
88 impl _gpgme_tofu_info {
89     #[inline]
validity(&self) -> c_uint90     pub fn validity(&self) -> c_uint {
91         (self.bitfield & 0b0000_0111) as c_uint
92     }
93 
94     #[inline]
policy(&self) -> gpgme_tofu_policy_t95     pub fn policy(&self) -> gpgme_tofu_policy_t {
96         ((self.bitfield & 0b1111_0000) >> 4) as gpgme_tofu_policy_t
97     }
98 }
99 
100 #[repr(C)]
101 #[derive(Copy, Clone)]
102 pub struct _gpgme_subkey {
103     pub next: gpgme_subkey_t,
104     pub bitfield: u32,
105     pub pubkey_algo: gpgme_pubkey_algo_t,
106     pub length: c_uint,
107     pub keyid: *mut c_char,
108     _keyid: [c_char; 17],
109     pub fpr: *mut c_char,
110     pub timestamp: c_long,
111     pub expires: c_long,
112     pub card_number: *mut c_char,
113     pub curve: *mut c_char,
114     pub keygrip: *mut c_char,
115 }
116 pub type gpgme_subkey_t = *mut _gpgme_subkey;
117 
118 impl _gpgme_subkey {
119     #[inline]
revoked(&self) -> bool120     pub fn revoked(&self) -> bool {
121         (self.bitfield & 0b0000_00000001) == 0b0000_00000001
122     }
123     #[inline]
expired(&self) -> bool124     pub fn expired(&self) -> bool {
125         (self.bitfield & 0b0000_00000010) == 0b0000_00000010
126     }
127     #[inline]
disabled(&self) -> bool128     pub fn disabled(&self) -> bool {
129         (self.bitfield & 0b0000_00000100) == 0b0000_00000100
130     }
131     #[inline]
invalid(&self) -> bool132     pub fn invalid(&self) -> bool {
133         (self.bitfield & 0b0000_00001000) == 0b0000_00001000
134     }
135     #[inline]
can_encrypt(&self) -> bool136     pub fn can_encrypt(&self) -> bool {
137         (self.bitfield & 0b0000_00010000) == 0b0000_00010000
138     }
139     #[inline]
can_sign(&self) -> bool140     pub fn can_sign(&self) -> bool {
141         (self.bitfield & 0b0000_00100000) == 0b0000_00100000
142     }
143     #[inline]
can_certify(&self) -> bool144     pub fn can_certify(&self) -> bool {
145         (self.bitfield & 0b0000_01000000) == 0b0000_01000000
146     }
147     #[inline]
secret(&self) -> bool148     pub fn secret(&self) -> bool {
149         (self.bitfield & 0b0000_10000000) == 0b0000_10000000
150     }
151     #[inline]
can_authenticate(&self) -> bool152     pub fn can_authenticate(&self) -> bool {
153         (self.bitfield & 0b0001_00000000) == 0b0001_00000000
154     }
155     #[inline]
is_qualified(&self) -> bool156     pub fn is_qualified(&self) -> bool {
157         (self.bitfield & 0b0010_00000000) == 0b0010_00000000
158     }
159     #[inline]
is_cardkey(&self) -> bool160     pub fn is_cardkey(&self) -> bool {
161         (self.bitfield & 0b0100_00000000) == 0b0100_00000000
162     }
163     #[inline]
is_de_vs(&self) -> bool164     pub fn is_de_vs(&self) -> bool {
165         (self.bitfield & 0b1000_00000000) == 0b1000_00000000
166     }
167 }
168 
169 #[repr(C)]
170 #[derive(Copy, Clone)]
171 pub struct _gpgme_key_sig {
172     pub next: gpgme_key_sig_t,
173     pub bitfield: u32,
174     pub pubkey_algo: gpgme_pubkey_algo_t,
175     pub keyid: *mut c_char,
176     _keyid: [c_char; 17],
177     pub timestamp: c_long,
178     pub expires: c_long,
179     pub status: gpgme_error_t,
180     _class: c_uint,
181     pub uid: *mut c_char,
182     pub name: *mut c_char,
183     pub email: *mut c_char,
184     pub comment: *mut c_char,
185     pub sig_class: c_uint,
186     pub notations: gpgme_sig_notation_t,
187     _last_notation: gpgme_sig_notation_t,
188     pub trust_scope: *mut c_char,
189 }
190 pub type gpgme_key_sig_t = *mut _gpgme_key_sig;
191 
192 impl _gpgme_key_sig {
193     #[inline]
revoked(&self) -> bool194     pub fn revoked(&self) -> bool {
195         (self.bitfield & 0b0001) == 0b0001
196     }
197     #[inline]
expired(&self) -> bool198     pub fn expired(&self) -> bool {
199         (self.bitfield & 0b0010) == 0b0010
200     }
201     #[inline]
invalid(&self) -> bool202     pub fn invalid(&self) -> bool {
203         (self.bitfield & 0b0100) == 0b0100
204     }
205     #[inline]
exportable(&self) -> bool206     pub fn exportable(&self) -> bool {
207         (self.bitfield & 0b1000) == 0b1000
208     }
209     #[inline]
trust_depth(&self) -> u8210     pub fn trust_depth(&self) -> u8 {
211         ((self.bitfield >> 16) & 0xFF) as u8
212     }
213     #[inline]
trust_value(&self) -> u8214     pub fn trust_value(&self) -> u8 {
215         (self.bitfield >> 24) as u8
216     }
217 }
218 
219 #[repr(C)]
220 #[derive(Copy, Clone)]
221 pub struct _gpgme_user_id {
222     pub next: gpgme_user_id_t,
223     pub bitfield: u32,
224     pub validity: gpgme_validity_t,
225     pub uid: *mut c_char,
226     pub name: *mut c_char,
227     pub email: *mut c_char,
228     pub comment: *mut c_char,
229     pub signatures: gpgme_key_sig_t,
230     _last_keysig: gpgme_key_sig_t,
231     pub address: *mut c_char,
232     pub tofu: gpgme_tofu_info_t,
233     pub last_update: c_ulong,
234     pub uidhash: *mut c_char,
235 }
236 pub type gpgme_user_id_t = *mut _gpgme_user_id;
237 
238 impl _gpgme_user_id {
239     #[inline]
revoked(&self) -> bool240     pub fn revoked(&self) -> bool {
241         (self.bitfield & 0b0001) == 0b0001
242     }
243     #[inline]
invalid(&self) -> bool244     pub fn invalid(&self) -> bool {
245         (self.bitfield & 0b0010) == 0b0010
246     }
247     #[inline]
origin(&self) -> u32248     pub fn origin(&self) -> u32 {
249         self.bitfield >> 27
250     }
251 }
252 
253 #[repr(C)]
254 #[derive(Copy, Clone)]
255 pub struct _gpgme_key {
256     _refs: c_uint,
257     pub bitfield: u32,
258     pub protocol: gpgme_protocol_t,
259     pub issuer_serial: *mut c_char,
260     pub issuer_name: *mut c_char,
261     pub chain_id: *mut c_char,
262     pub owner_trust: gpgme_validity_t,
263     pub subkeys: gpgme_subkey_t,
264     pub uids: gpgme_user_id_t,
265     _last_subkey: gpgme_subkey_t,
266     _last_uid: gpgme_user_id_t,
267     pub keylist_mode: gpgme_keylist_mode_t,
268     pub fpr: *mut c_char,
269     pub last_update: c_ulong,
270 }
271 pub type gpgme_key_t = *mut _gpgme_key;
272 
273 impl _gpgme_key {
274     #[inline]
revoked(&self) -> bool275     pub fn revoked(&self) -> bool {
276         (self.bitfield & 0b00_00000001) == 0b00_00000001
277     }
278     #[inline]
expired(&self) -> bool279     pub fn expired(&self) -> bool {
280         (self.bitfield & 0b00_00000010) == 0b00_00000010
281     }
282     #[inline]
disabled(&self) -> bool283     pub fn disabled(&self) -> bool {
284         (self.bitfield & 0b00_00000100) == 0b00_00000100
285     }
286     #[inline]
invalid(&self) -> bool287     pub fn invalid(&self) -> bool {
288         (self.bitfield & 0b00_00001000) == 0b00_00001000
289     }
290     #[inline]
can_encrypt(&self) -> bool291     pub fn can_encrypt(&self) -> bool {
292         (self.bitfield & 0b00_00010000) == 0b00_00010000
293     }
294     #[inline]
can_sign(&self) -> bool295     pub fn can_sign(&self) -> bool {
296         (self.bitfield & 0b00_00100000) == 0b00_00100000
297     }
298     #[inline]
can_certify(&self) -> bool299     pub fn can_certify(&self) -> bool {
300         (self.bitfield & 0b00_01000000) == 0b00_01000000
301     }
302     #[inline]
secret(&self) -> bool303     pub fn secret(&self) -> bool {
304         (self.bitfield & 0b00_10000000) == 0b00_10000000
305     }
306     #[inline]
can_authenticate(&self) -> bool307     pub fn can_authenticate(&self) -> bool {
308         (self.bitfield & 0b01_00000000) == 0b01_00000000
309     }
310     #[inline]
is_qualified(&self) -> bool311     pub fn is_qualified(&self) -> bool {
312         (self.bitfield & 0b10_00000000) == 0b10_00000000
313     }
314     #[inline]
origin(&self) -> u32315     pub fn origin(&self) -> u32 {
316         self.bitfield >> 27
317     }
318 }
319 
320 pub type gpgme_passphrase_cb_t =
321     Option<extern "C" fn(*mut c_void, *const c_char, *const c_char, c_int, c_int) -> gpgme_error_t>;
322 pub type gpgme_progress_cb_t =
323     Option<extern "C" fn(*mut c_void, *const c_char, c_int, c_int, c_int)>;
324 pub type gpgme_status_cb_t =
325     Option<extern "C" fn(*mut c_void, *const c_char, *const c_char) -> gpgme_error_t>;
326 pub type gpgme_interact_cb_t =
327     Option<extern "C" fn(*mut c_void, *const c_char, *const c_char, c_int) -> gpgme_error_t>;
328 pub type gpgme_edit_cb_t =
329     Option<extern "C" fn(*mut c_void, gpgme_status_code_t, *const c_char, c_int) -> gpgme_error_t>;
330 
331 pub type gpgme_io_cb_t = Option<extern "C" fn(*mut c_void, c_int) -> gpgme_error_t>;
332 pub type gpgme_register_io_cb_t = Option<
333     extern "C" fn(
334         *mut c_void,
335         c_int,
336         c_int,
337         gpgme_io_cb_t,
338         *mut c_void,
339         *mut *mut c_void,
340     ) -> gpgme_error_t,
341 >;
342 pub type gpgme_remove_io_cb_t = Option<extern "C" fn(*mut c_void)>;
343 
344 #[repr(C)]
345 #[derive(Copy, Clone)]
346 pub struct gpgme_io_event_done_data {
347     pub err: gpgme_error_t,
348     pub op_err: gpgme_error_t,
349 }
350 pub type gpgme_io_event_done_data_t = *mut gpgme_io_event_done_data;
351 
352 pub type gpgme_event_io_cb_t = Option<extern "C" fn(*mut c_void, gpgme_event_io_t, *mut c_void)>;
353 
354 #[repr(C)]
355 #[derive(Copy, Clone)]
356 pub struct gpgme_io_cbs {
357     pub add: gpgme_register_io_cb_t,
358     pub add_priv: *mut c_void,
359     pub remove: gpgme_remove_io_cb_t,
360     pub event: gpgme_event_io_cb_t,
361     pub event_priv: *mut c_void,
362 }
363 pub type gpgme_io_cbs_t = *mut gpgme_io_cbs;
364 
365 pub type gpgme_data_read_cb_t = Option<extern "C" fn(*mut c_void, *mut c_void, size_t) -> ssize_t>;
366 pub type gpgme_data_write_cb_t =
367     Option<extern "C" fn(*mut c_void, *const c_void, size_t) -> ssize_t>;
368 pub type gpgme_data_seek_cb_t =
369     Option<extern "C" fn(*mut c_void, libc::off_t, c_int) -> libc::off_t>;
370 pub type gpgme_data_release_cb_t = Option<extern "C" fn(*mut c_void)>;
371 
372 #[repr(C)]
373 #[derive(Copy, Clone)]
374 pub struct gpgme_data_cbs {
375     pub read: gpgme_data_read_cb_t,
376     pub write: gpgme_data_write_cb_t,
377     pub seek: gpgme_data_seek_cb_t,
378     pub release: gpgme_data_release_cb_t,
379 }
380 pub type gpgme_data_cbs_t = *mut gpgme_data_cbs;
381 
382 #[repr(C)]
383 #[derive(Copy, Clone)]
384 pub struct _gpgme_invalid_key {
385     pub next: gpgme_invalid_key_t,
386     pub fpr: *mut c_char,
387     pub reason: gpgme_error_t,
388 }
389 pub type gpgme_invalid_key_t = *mut _gpgme_invalid_key;
390 
391 #[repr(C)]
392 #[derive(Copy, Clone)]
393 pub struct _gpgme_op_encrypt_result {
394     pub invalid_recipients: gpgme_invalid_key_t,
395 }
396 pub type gpgme_encrypt_result_t = *mut _gpgme_op_encrypt_result;
397 
398 #[repr(C)]
399 #[derive(Copy, Clone)]
400 pub struct _gpgme_recipient {
401     pub next: gpgme_recipient_t,
402     pub keyid: *mut c_char,
403     _keyid: [c_char; 17],
404     pub pubkey_algo: gpgme_pubkey_algo_t,
405     pub status: gpgme_error_t,
406 }
407 pub type gpgme_recipient_t = *mut _gpgme_recipient;
408 
409 #[repr(C)]
410 #[derive(Copy, Clone)]
411 pub struct _gpgme_op_decrypt_result {
412     pub unsupported_algorithm: *mut c_char,
413     pub bitfield: u32,
414     pub recipients: gpgme_recipient_t,
415     pub file_name: *mut c_char,
416     pub session_key: *mut c_char,
417     pub symkey_algo: *mut c_char,
418 }
419 pub type gpgme_decrypt_result_t = *mut _gpgme_op_decrypt_result;
420 
421 impl _gpgme_op_decrypt_result {
422     #[inline]
wrong_key_usage(&self) -> bool423     pub fn wrong_key_usage(&self) -> bool {
424         (self.bitfield & 0b0001) == 0b0001
425     }
426 
427     #[inline]
is_de_vs(&self) -> bool428     pub fn is_de_vs(&self) -> bool {
429         (self.bitfield & 0b0010) == 0b0010
430     }
431 
432     #[inline]
is_mime(&self) -> bool433     pub fn is_mime(&self) -> bool {
434         (self.bitfield & 0b0100) == 0b0100
435     }
436 
437     #[inline]
legacy_cipher_nomdc(&self) -> bool438     pub fn legacy_cipher_nomdc(&self) -> bool {
439         (self.bitfield & 0b1000) == 0b1000
440     }
441 }
442 
443 #[repr(C)]
444 #[derive(Copy, Clone)]
445 pub struct _gpgme_new_signature {
446     pub next: gpgme_new_signature_t,
447     pub typ: gpgme_sig_mode_t,
448     pub pubkey_algo: gpgme_pubkey_algo_t,
449     pub hash_algo: gpgme_hash_algo_t,
450     _class1: c_ulong,
451     pub timestamp: c_long,
452     pub fpr: *mut c_char,
453     _class2: c_uint,
454     pub sig_class: c_uint,
455 }
456 pub type gpgme_new_signature_t = *mut _gpgme_new_signature;
457 
458 #[repr(C)]
459 #[derive(Copy, Clone)]
460 pub struct _gpgme_op_sign_result {
461     pub invalid_signers: gpgme_invalid_key_t,
462     pub signatures: gpgme_new_signature_t,
463 }
464 pub type gpgme_sign_result_t = *mut _gpgme_op_sign_result;
465 
466 #[repr(C)]
467 #[derive(Copy, Clone)]
468 pub struct _gpgme_signature {
469     pub next: gpgme_signature_t,
470     pub summary: gpgme_sigsum_t,
471     pub fpr: *mut c_char,
472     pub status: gpgme_error_t,
473     pub notations: gpgme_sig_notation_t,
474     pub timestamp: c_ulong,
475     pub exp_timestamp: c_ulong,
476     pub bitfield: u32,
477     pub validity: gpgme_validity_t,
478     pub validity_reason: gpgme_error_t,
479     pub pubkey_algo: gpgme_pubkey_algo_t,
480     pub hash_algo: gpgme_hash_algo_t,
481     pub pka_address: *mut c_char,
482     pub key: gpgme_key_t,
483 }
484 pub type gpgme_signature_t = *mut _gpgme_signature;
485 
486 impl _gpgme_signature {
487     #[inline]
wrong_key_usage(&self) -> bool488     pub fn wrong_key_usage(&self) -> bool {
489         (self.bitfield & 0b0001) == 0b0001
490     }
491 
492     #[inline]
pka_trust(&self) -> c_uint493     pub fn pka_trust(&self) -> c_uint {
494         (self.bitfield & 0b0110) >> 1
495     }
496 
497     #[inline]
chain_model(&self) -> bool498     pub fn chain_model(&self) -> bool {
499         (self.bitfield & 0b1000) == 0b1000
500     }
501 
502     #[inline]
is_de_vs(&self) -> bool503     pub fn is_de_vs(&self) -> bool {
504         (self.bitfield & 0b1_0000) == 0b1_0000
505     }
506 }
507 
508 #[repr(C)]
509 #[derive(Copy, Clone)]
510 pub struct _gpgme_op_verify_result {
511     pub signatures: gpgme_signature_t,
512     pub file_name: *mut c_char,
513     pub bitfield: u32,
514 }
515 pub type gpgme_verify_result_t = *mut _gpgme_op_verify_result;
516 
517 impl _gpgme_op_verify_result {
518     #[inline]
is_mime(&self) -> bool519     pub fn is_mime(&self) -> bool {
520         (self.bitfield & 0b0001) == 0b0001
521     }
522 }
523 
524 #[repr(C)]
525 #[derive(Copy, Clone)]
526 pub struct _gpgme_import_status {
527     pub next: gpgme_import_status_t,
528     pub fpr: *mut c_char,
529     pub result: gpgme_error_t,
530     pub status: c_uint,
531 }
532 pub type gpgme_import_status_t = *mut _gpgme_import_status;
533 
534 #[repr(C)]
535 #[derive(Copy, Clone)]
536 pub struct _gpgme_op_import_result {
537     pub considered: c_int,
538     pub no_user_id: c_int,
539     pub imported: c_int,
540     pub imported_rsa: c_int,
541     pub unchanged: c_int,
542     pub new_user_ids: c_int,
543     pub new_sub_keys: c_int,
544     pub new_signatures: c_int,
545     pub new_revocations: c_int,
546     pub secret_read: c_int,
547     pub secret_imported: c_int,
548     pub secret_unchanged: c_int,
549     pub skipped_new_keys: c_int,
550     pub not_imported: c_int,
551     pub imports: gpgme_import_status_t,
552     pub skipped_v3_keys: c_int,
553 }
554 pub type gpgme_import_result_t = *mut _gpgme_op_import_result;
555 
556 #[repr(C)]
557 #[derive(Copy, Clone)]
558 pub struct _gpgme_op_genkey_result {
559     pub bitfield: u32,
560     pub fpr: *mut c_char,
561     pub pubkey: gpgme_data_t,
562     pub seckey: gpgme_data_t,
563 }
564 pub type gpgme_genkey_result_t = *mut _gpgme_op_genkey_result;
565 
566 impl _gpgme_op_genkey_result {
567     #[inline]
primary(&self) -> bool568     pub fn primary(&self) -> bool {
569         (self.bitfield & 0b001) == 0b001
570     }
571 
572     #[inline]
sub(&self) -> bool573     pub fn sub(&self) -> bool {
574         (self.bitfield & 0b010) == 0b010
575     }
576 
577     #[inline]
uid(&self) -> bool578     pub fn uid(&self) -> bool {
579         (self.bitfield & 0b100) == 0b100
580     }
581 }
582 
583 #[repr(C)]
584 #[derive(Copy, Clone)]
585 pub struct _gpgme_op_keylist_result {
586     pub bitfield: u32,
587 }
588 pub type gpgme_keylist_result_t = *mut _gpgme_op_keylist_result;
589 
590 impl _gpgme_op_keylist_result {
591     #[inline]
truncated(&self) -> bool592     pub fn truncated(&self) -> bool {
593         (self.bitfield & 0b1) == 0b1
594     }
595 }
596 
597 pub type gpgme_assuan_data_cb_t =
598     Option<extern "C" fn(*mut c_void, *const c_void, size_t) -> gpgme_error_t>;
599 pub type gpgme_assuan_inquire_cb_t = Option<
600     extern "C" fn(*mut c_void, *const c_char, *const c_char, *mut gpgme_data_t) -> gpgme_error_t,
601 >;
602 pub type gpgme_assuan_status_cb_t =
603     Option<extern "C" fn(*mut c_void, *const c_char, *const c_char) -> gpgme_error_t>;
604 
605 #[repr(C)]
606 #[derive(Copy, Clone)]
607 pub struct _gpgme_op_vfs_mount_result {
608     pub mount_dir: *mut c_char,
609 }
610 pub type gpgme_vfs_mount_result_t = *mut _gpgme_op_vfs_mount_result;
611 
612 #[repr(C)]
613 #[derive(Copy, Clone)]
614 pub struct gpgme_conf_arg {
615     pub next: gpgme_conf_arg_t,
616     pub no_arg: c_uint,
617     pub value: libc::uintptr_t,
618 }
619 pub type gpgme_conf_arg_t = *mut gpgme_conf_arg;
620 
621 #[repr(C)]
622 #[derive(Copy, Clone)]
623 pub struct gpgme_conf_opt {
624     pub next: gpgme_conf_opt_t,
625     pub name: *mut c_char,
626     pub flags: c_uint,
627     pub level: gpgme_conf_level_t,
628     pub description: *mut c_char,
629     pub typ: gpgme_conf_type_t,
630     pub alt_type: gpgme_conf_type_t,
631     pub argname: *mut c_char,
632     pub default_value: gpgme_conf_arg_t,
633     pub default_description: *mut c_char,
634     pub no_arg_value: gpgme_conf_arg_t,
635     pub no_arg_description: *mut c_char,
636     pub value: gpgme_conf_arg_t,
637     pub change_value: c_int,
638     pub new_value: gpgme_conf_arg_t,
639     pub user_data: *mut c_void,
640 }
641 pub type gpgme_conf_opt_t = *mut gpgme_conf_opt;
642 
643 #[repr(C)]
644 #[derive(Copy, Clone)]
645 pub struct gpgme_conf_comp {
646     pub next: gpgme_conf_comp_t,
647     _last_opt_p: *mut gpgme_conf_opt_t,
648     pub name: *mut c_char,
649     pub description: *mut c_char,
650     pub program_name: *mut c_char,
651     pub options: gpgme_conf_opt_t,
652 }
653 pub type gpgme_conf_comp_t = *mut gpgme_conf_comp;
654 
655 #[repr(C)]
656 #[derive(Copy, Clone)]
657 pub struct _gpgme_op_query_swdb_result {
658     pub next: *mut _gpgme_op_query_swdb_result,
659     pub name: *mut c_char,
660     pub iversion: *mut c_char,
661     pub created: c_ulong,
662     pub retrieved: c_ulong,
663     bitfield: u32,
664     pub version: *mut c_char,
665     pub reldate: c_ulong,
666 }
667 
668 impl _gpgme_op_query_swdb_result {
669     #[inline]
warning(&self) -> bool670     pub fn warning(&self) -> bool {
671         (self.bitfield & 0b0000_0001) == 0b0000_0001
672     }
673 
674     #[inline]
update(&self) -> bool675     pub fn update(&self) -> bool {
676         (self.bitfield & 0b0000_0010) == 0b0000_0010
677     }
678 
679     #[inline]
urgent(&self) -> bool680     pub fn urgent(&self) -> bool {
681         (self.bitfield & 0b0000_0100) == 0b0000_0100
682     }
683 
684     #[inline]
noinfo(&self) -> bool685     pub fn noinfo(&self) -> bool {
686         (self.bitfield & 0b0000_1000) == 0b0000_1000
687     }
688 
689     #[inline]
unknown(&self) -> bool690     pub fn unknown(&self) -> bool {
691         (self.bitfield & 0b0001_0000) == 0b0001_0000
692     }
693 
694     #[inline]
tooold(&self) -> bool695     pub fn tooold(&self) -> bool {
696         (self.bitfield & 0b0010_0000) == 0b0010_0000
697     }
698 
699     #[inline]
error(&self) -> bool700     pub fn error(&self) -> bool {
701         (self.bitfield & 0b0100_0000) == 0b0100_0000
702     }
703 }
704 pub type gpgme_query_swdb_result_t = *mut _gpgme_op_query_swdb_result;
705